Social-network-aware matrix factorization
This implementation assumes a binary and symmetrical trust network. Mohsen Jamali, Martin Ester: A matrix factorization technique with trust propagation for recommendation in social networks RecSys '10: Proceedings of the Fourth ACM Conference on Recommender Systems, 2010
Inheritance: BiasedMatrixFactorization, IUserRelationAwareRecommender
        public void TestCurrentLearnRate()
        {
            var mf = new SocialMF() { LearnRate = 1.1f, Ratings = TestUtils.CreateRatings(), UserRelation = new SparseBooleanMatrix() };

            mf.InitModel();
            Assert.AreEqual(1.1f, mf.LearnRate);
            Assert.AreEqual(1.1f, mf.current_learnrate);
        }
Exemple #2
0
		public void TestMatrixInit()
		{
			var mf = new SocialMF() { Ratings = TestUtils.CreateRatings(), UserRelation = new SparseBooleanMatrix() };
			mf.InitModel();
			Assert.IsNotNull(mf.user_factors);
			Assert.IsNotNull(mf.item_factors);
			Assert.IsNotNull(mf.user_bias);
			Assert.IsNotNull(mf.item_bias);
		}
 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);
 }
        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);
        }
 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);
 }