Advertisement
Guest User

Untitled

a guest
Jul 24th, 2019
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.78 KB | None | 0 0
  1. public BikeSharingDemandPrediction Predict(BikeSharingDemandSample sample)
  2. {
  3. return _predictionEngine.Predict(sample);
  4. }
  5.  
  6. public RegressionMetrics Evaluate(string testDataLocation)
  7. {
  8. var testDataView = _mlContext.Data.LoadFromTextFile<BikeSharingDemandSample>(
  9. path: testDataLocation,
  10. hasHeader: true,
  11. separatorChar: ',',
  12. allowQuoting: true,
  13. allowSparse: false);
  14. var predictions = _trainedModel.Transform(testDataView);
  15. return _mlContext.Regression.Evaluate(predictions, "Label", "Score");
  16. }
  17.  
  18. public void SaveModel()
  19. {
  20. _mlContext.Model.Save(_trainedModel, _trainingDataView.Schema, "./BikeSharingDemandsModel.zip");
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement