Ejemplo n.º 1
0
        private static void TrainForItemPrediction(Mapping userMapping, Mapping itemMapping, String[] args)
        {
            var training_data = ItemData.Read(trainingCompactFileForItems, userMapping, itemMapping);

            itemRecommender = new CustomBPRMF();
            if (File.Exists(Path.Combine(args[2], "model")))
            {
                Console.WriteLine("Skipping training, Loading saved model");
                itemRecommender.LoadModel(Path.Combine(args[2], "model"));
                itemRecommender.Feedback = training_data;
                return;
            }

            Console.WriteLine("Training model for Item Prediction, this may take a while...");
            itemRecommender.Feedback   = training_data;
            itemRecommender.NumFactors = 50;
            itemRecommender.NumIter    = 100;
            itemRecommender.Train();
            itemRecommender.SaveModel(Path.Combine(args[2], "model"));
        }
Ejemplo n.º 2
0
        private static void TrainForItemPrediction(Mapping userMapping, Mapping itemMapping, String[] args)
        {
            var training_data = ItemData.Read(trainingCompactFileForItems, userMapping, itemMapping);
            itemRecommender = new CustomBPRMF();
            if (File.Exists(Path.Combine(args[2], "model")))
            {
                Console.WriteLine("Skipping training, Loading saved model");
                itemRecommender.LoadModel(Path.Combine(args[2], "model"));
                itemRecommender.Feedback = training_data;
                return;
            }

            Console.WriteLine("Training model for Item Prediction, this may take a while...");
            itemRecommender.Feedback = training_data;
            itemRecommender.NumFactors = 50;
            itemRecommender.NumIter = 100;
            itemRecommender.Train();
            itemRecommender.SaveModel(Path.Combine(args[2], "model"));
        }