Predict() public method

public Predict ( int user_id, int item_id ) : double
user_id int
item_id int
return double
Beispiel #1
0
        public void TestNewUserInTestSet()
        {
            var recommender = new SlopeOne();

            var training_data = new Ratings();
            training_data.Add(0, 0, 1.0f);
            training_data.Add(1, 1, 5.0f);

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

            Assert.AreEqual( 3.0, recommender.Predict(2, 1) );
        }
Beispiel #2
0
        public void TestNewItemInTestSet()
        {
            var recommender = new SlopeOne();
            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) );
        }