Created
July 12, 2019 13:55
-
-
Save NMZivkovic/dbfee1b1ad1910b5f5fca807a0f4db89 to your computer and use it in GitHub Desktop.
This file contains hidden or 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