Skip to content

Instantly share code, notes, and snippets.

@indraone01
Forked from mdfarragher/mlnet-taxidemo-rmse.cs
Created March 10, 2022 01:34
Show Gist options
  • Save indraone01/e286541926c18740673338b19a872112 to your computer and use it in GitHub Desktop.
Save indraone01/e286541926c18740673338b19a872112 to your computer and use it in GitHub Desktop.
This code is part of the ML.NET taxi fare prediction demo.
// get a set of predictions
Console.Write("Evaluating the model....");
var predictions = model.Transform(partitions.TestSet);
// get regression metrics to score the model
var metrics = mlContext.Regression.Evaluate(predictions, "Label", "Score");
Console.WriteLine("done");
// show the metrics
Console.WriteLine();
Console.WriteLine($"Model metrics:");
Console.WriteLine($" RMSE: {metrics.Rms:#.##}");
Console.WriteLine($" L1: {metrics.L1:#.##}");
Console.WriteLine($" L2: {metrics.L2:#.##}");
Console.WriteLine();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment