-
-
Save Belgian-Coder/15b12841c056f23074d91fabf2d81f3a to your computer and use it in GitHub Desktop.
Ordina-ML.Net_Recommender_System
This file contains 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
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