Skip to content

Instantly share code, notes, and snippets.

@Belgian-Coder
Last active Jan 12, 2019
Embed
What would you like to do?
Ordina-ML.Net_Recommender_System
var predictionFunction = model.CreatePredictionEngine<BookRating, BookRatingPrediction>(mlContext);
var bookPrediction = predictionFunction.Predict(new BookRating
{
user = 91,
bookid = 10365
});
Console.WriteLine($"Predicted rating: {Math.Round(bookPrediction.Score, 1)}");
Console.ReadLine();
Console.WriteLine("Saving model");
using (var stream = new FileStream(
Path.Combine(Environment.CurrentDirectory, Filenames.TrainedModel),
FileMode.Create,
FileAccess.Write,
FileShare.Write))
{
mlContext.Model.Save(model, stream);
Console.WriteLine($"The model is saved as {Filenames.TrainedModel}");
}
Console.ReadLine();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment