Train() public method

public Train ( ) : void
return void
Example #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) );
        }
Example #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) );
        }