Skip to content

Instantly share code, notes, and snippets.

@NMZivkovic
Created June 17, 2018 08:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save NMZivkovic/42cd77b82ff7b207a1a1b3320210edcd to your computer and use it in GitHub Desktop.
Save NMZivkovic/42cd77b82ff7b207a1a1b3320210edcd to your computer and use it in GitHub Desktop.
/// <summary>
/// Ussing passed testing data and model, it calculates model's accuracy.
/// </summary>
/// <returns>Accuracy of the model.</returns>
public double Evaluate(PredictionModel<IrisFlower, IrisPredict> model, string testDataLocation)
{
var testData = new TextLoader(testDataLocation).CreateFrom<IrisFlower>(useHeader: true, separator: ',');
var metrics = new ClassificationEvaluator().Evaluate(model, testData);
return metrics.AccuracyMacro;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment