public void CreateClustersEpinion()
        {
            var reader = new EpinionReader(Paths.EpinionRatings);
            var dataset = new Dataset<ItemRating>(reader);
            var clusterer = new Clusterer(dataset);

            for (int i = 2; i < 15; i += 2)
            {
                clusterer.WriteUsersCluster(Paths.EpinionUsersCluster + i + ".csv", i, 5);
                clusterer.WriteItemsCluster(Paths.EpinionItemsCluster + i + ".csv", i, 5);
            }
        }
        public void CreateClustersEpinion()
        {
            var reader    = new EpinionReader(Paths.EpinionRatings);
            var dataset   = new Dataset <ItemRating>(reader);
            var clusterer = new Clusterer(dataset);

            for (int i = 2; i < 15; i += 2)
            {
                clusterer.WriteUsersCluster(Paths.EpinionUsersCluster + i + ".csv", i, 5);
                clusterer.WriteItemsCluster(Paths.EpinionItemsCluster + i + ".csv", i, 5);
            }
        }
        public void TestEpinionClusters()
        {
            List <string> rmses = new List <string>();
            List <string> maes  = new List <string>();

            for (int i = 0; i < 15; i += 2)
            {
                string usersClusterFile = Paths.EpinionUsersCluster + i + ".csv";
                string itemsClusterFile = Paths.EpinionItemsCluster + i + ".csv";

                EpinionReader trainReader, testReader;

                if (i == 0)
                {
                    trainReader = new EpinionReader(Paths.EpinionTrain75);
                    testReader  = new EpinionReader(Paths.EpinionTest25);
                }
                else
                {
                    trainReader = new EpinionReader(Paths.EpinionTrain75, usersClusterFile, itemsClusterFile);
                    testReader  = new EpinionReader(Paths.EpinionTest25, usersClusterFile, itemsClusterFile);
                }

                var dataset = new Dataset <EpinionItemRating>(trainReader, testReader);

                var recommender = new LibFmTrainTester();

                var context = new EvalutationContext <ItemRating>(recommender, dataset);

                var ep = new EvaluationPipeline <ItemRating>(context);
                ep.Evaluators.Add(new RMSE());
                ep.Evaluators.Add(new MAE());

                ep.Run();

                rmses.Add(context["RMSE"].ToString());
                maes.Add(context["MAE"].ToString());
            }

            Console.WriteLine("RMSEs--------------");
            rmses.ForEach(Console.WriteLine);

            Console.WriteLine("MAEs-------------");
            maes.ForEach(Console.WriteLine);
        }
        public void TestEpinionClusters()
        {
            List<string> rmses = new List<string>();
            List<string> maes = new List<string>();

            for (int i = 0; i < 15; i += 2)
            {
                string usersClusterFile = Paths.EpinionUsersCluster + i + ".csv";
                string itemsClusterFile = Paths.EpinionItemsCluster + i + ".csv";

                EpinionReader trainReader, testReader;

                if (i == 0)
                {
                    trainReader = new EpinionReader(Paths.EpinionTrain75);
                    testReader = new EpinionReader(Paths.EpinionTest25);
                }
                else
                {
                    trainReader = new EpinionReader(Paths.EpinionTrain75, usersClusterFile, itemsClusterFile);
                    testReader = new EpinionReader(Paths.EpinionTest25, usersClusterFile, itemsClusterFile);
                }

                var dataset = new Dataset<EpinionItemRating>(trainReader, testReader);

                var recommender = new LibFmTrainTester();

                var context = new EvalutationContext<ItemRating>(recommender, dataset);

                var ep = new EvaluationPipeline<ItemRating>(context);
                ep.Evaluators.Add(new RMSE());
                ep.Evaluators.Add(new MAE());

                ep.Run();

                rmses.Add(context["RMSE"].ToString());
                maes.Add(context["MAE"].ToString());
            }

            Console.WriteLine("RMSEs--------------");
            rmses.ForEach(Console.WriteLine);

            Console.WriteLine("MAEs-------------");
            maes.ForEach(Console.WriteLine);
        }