This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, "./BikeSharingDemandsModel.zip"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment