/// public override void Train() { baseline_predictor.Train(); InitModel(); if (correlation is IBinaryDataCorrelationMatrix) { ((IBinaryDataCorrelationMatrix)correlation).ComputeCorrelations(BinaryDataMatrix); } else { ((IRatingCorrelationMatrix)correlation).ComputeCorrelations(Ratings, Entity); } }
/// public override void Train() { // init factor matrices user_factors = new Matrix <float>(MaxUserID + 1, NumFactors); item_factors = new Matrix <float>(MaxItemID + 1, NumFactors); // init+train global effects model global_effects.Ratings = ratings; global_effects.Train(); // learn model parameters num_learned_factors = 0; for (int i = 0; i < NumIter; i++) { Iterate(); } }
public static void Main(string[] args) { // load the data var user_mapping = new EntityMapping(); var item_mapping = new EntityMapping(); var training_data = MyMediaLite.IO.RatingPrediction.Read(args[0], user_mapping, item_mapping); var test_data = MyMediaLite.IO.RatingPrediction.Read(args[1], user_mapping, item_mapping); // set up the recommender var recommender = new UserItemBaseline(); recommender.Ratings = training_data; recommender.Train(); // measure the accuracy on the test data set var results = RatingEval.Evaluate(recommender, test_data); Console.WriteLine("RMSE={0} MAE={1}", results["RMSE"], results["MAE"]); // make a prediction for a certain user and item Console.WriteLine(recommender.Predict(user_mapping.ToInternalID(1), item_mapping.ToInternalID(1))); }
public static void Main(string[] args) { // load the data var training_data = RatingData.Read(args[0]); var test_data = RatingData.Read(args[1]); // set up the recommender var recommender = new UserItemBaseline(); recommender.Ratings = training_data; recommender.Train(); // measure the accuracy on the test data set var results = recommender.Evaluate(test_data); Console.WriteLine("RMSE={0} MAE={1}", results["RMSE"], results["MAE"]); Console.WriteLine(results); // make a prediction for a certain user and item Console.WriteLine(recommender.Predict(1, 1)); var bmf = new BiasedMatrixFactorization {Ratings = training_data}; Console.WriteLine(bmf.DoCrossValidation()); }
/// public override void Train() { // init factor matrices user_factors = new Matrix <double>(Ratings.MaxUserID + 1, NumFactors); item_factors = new Matrix <double>(Ratings.MaxItemID + 1, NumFactors); // init+train global effects model global_effects.Ratings = Ratings; global_effects.Train(); global_bias = Ratings.Average; // initialize learning data structure residuals = new double[Ratings.Count]; // learn model parameters num_learned_factors = 0; for (int i = 0; i < NumIter; i++) { Iterate(); } }