Exemple #1
0
        public void TestNewUserInTestSet()
        {
            var recommender = new BiPolarSlopeOne();

            var training_data = new Ratings();

            training_data.Add(0, 0, 1.0f);
            training_data.Add(1, 1, 5.0f);
            training_data.InitScale();

            recommender.Ratings = training_data;
            recommender.Train();

            Assert.AreEqual(3.0f, recommender.Predict(2, 1));
        }
        public void TestNewItemInTestSet()
        {
            var recommender = new BiPolarSlopeOne();

            recommender.MinRating = 1;
            recommender.MaxRating = 5;

            var training_data = new Ratings();

            training_data.Add(0, 0, 1.0);
            training_data.Add(1, 1, 5.0);

            recommender.Ratings = training_data;
            recommender.Train();

            Assert.AreEqual(3.0, recommender.Predict(0, 2));
        }