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
Exemplo n.º 1
0
        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);
        }
Exemplo n.º 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);
		}
Exemplo n.º 3
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);
 }
Exemplo n.º 4
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);
        }
Exemplo n.º 5
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);
 }