Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
public BikeSharingDemandPrediction Predict(BikeSharingDemandSample sample)
return _predictionEngine.Predict(sample);
public RegressionMetrics Evaluate(string testDataLocation)
var testDataView = _mlContext.Data.LoadFromTextFile<BikeSharingDemandSample>(
path: testDataLocation,
hasHeader: true,
separatorChar: ',',
allowQuoting: true,
allowSparse: false);
var predictions = _trainedModel.Transform(testDataView);
return _mlContext.Regression.Evaluate(predictions, "Label", "Score");
public void SaveModel()
_mlContext.Model.Save(_trainedModel, _trainingDataView.Schema, "./");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment