Train() public method

public Train ( ) : void
return void
Ejemplo n.º 1
0
 public void TestFoldIn()
 {
     var mf = new SocialMF() { Ratings = TestUtils.CreateRatings(), UserRelation = new SparseBooleanMatrix() };
     mf.Train();
     var user_ratings = new List<Tuple<int, float>>();
     user_ratings.Add(new Tuple<int, float>(0, 4.0f));
     var candidate_items = new List<int> { 0, 1 }; // have a known and an unknown item
     var results = mf.ScoreItems(user_ratings, candidate_items);
     Assert.AreEqual(2, results.Count);
 }
Ejemplo n.º 2
0
        public void TestDecay()
        {
            var mf = new SocialMF()
            {
                LearnRate = 1.0f, Decay = 0.5f,
                NumIter = 1, Ratings = TestUtils.CreateRatings(),
                UserRelation = new SparseBooleanMatrix()
            };

            mf.Train();
            Assert.AreEqual(0.5f, mf.current_learnrate);

            mf.Iterate();
            Assert.AreEqual(0.25f, mf.current_learnrate);
        }
Ejemplo n.º 3
0
 public void TestDefaultBehaviorIsNoDecay()
 {
     var mf = new SocialMF() { LearnRate = 1.1f, NumIter = 10, Ratings = TestUtils.CreateRatings(), UserRelation = new SparseBooleanMatrix() };
     mf.Train();
     Assert.AreEqual(1.1f, mf.current_learnrate);
 }