org.mymedialite.ratingprediction
Class SocialMF
java.lang.Object
org.mymedialite.ratingprediction.RatingPredictor
org.mymedialite.ratingprediction.IncrementalRatingPredictor
org.mymedialite.ratingprediction.MatrixFactorization
org.mymedialite.ratingprediction.BiasedMatrixFactorization
org.mymedialite.ratingprediction.SocialMF
- All Implemented Interfaces:
- java.lang.Cloneable, IIterativeModel, IRecommender, IUserRelationAwareRecommender, IIncrementalRatingPredictor, IRatingPredictor
public class SocialMF
- extends BiasedMatrixFactorization
- implements IUserRelationAwareRecommender
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
Method Summary |
double |
computeLoss()
Compute the regularized loss. |
SparseBooleanMatrix |
getUserRelation()
Getter for binary user relation |
protected void |
initModel()
Initialize the model data structure. |
protected void |
iterate(java.util.List<java.lang.Integer> rating_indices,
boolean update_user,
boolean update_item)
Iterate once over rating data and adjust corresponding factors (stochastic gradient descent). |
int |
numUsers()
The number of users. |
void |
setUserRelation(SparseBooleanMatrix user_neighbors)
Setter for binary user relation |
java.lang.String |
toString()
Return a string representation of the recommender |
void |
train()
Learn the model parameters of the recommender from the training data |
Methods inherited from class org.mymedialite.ratingprediction.BiasedMatrixFactorization |
addItem, addUser, iterate, iterateRMSE, loadModel, predict, removeItem, removeUser, retrainItem, retrainUser, saveModel, setRegularization |
Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
SocialMF
public SocialMF()
getUserRelation
public SparseBooleanMatrix getUserRelation()
- Description copied from interface:
IUserRelationAwareRecommender
- Getter for binary user relation
- Specified by:
getUserRelation
in interface IUserRelationAwareRecommender
setUserRelation
public void setUserRelation(SparseBooleanMatrix user_neighbors)
- Description copied from interface:
IUserRelationAwareRecommender
- Setter for binary user relation
- Specified by:
setUserRelation
in interface IUserRelationAwareRecommender
numUsers
public int numUsers()
- The number of users.
- Specified by:
numUsers
in interface IUserRelationAwareRecommender
initModel
protected void initModel()
- Description copied from class:
MatrixFactorization
- Initialize the model data structure.
- Overrides:
initModel
in class BiasedMatrixFactorization
train
public void train()
- Description copied from interface:
IRecommender
- Learn the model parameters of the recommender from the training data
- Specified by:
train
in interface IRecommender
- Overrides:
train
in class BiasedMatrixFactorization
iterate
protected void iterate(java.util.List<java.lang.Integer> rating_indices,
boolean update_user,
boolean update_item)
- Description copied from class:
MatrixFactorization
- Iterate once over rating data and adjust corresponding factors (stochastic gradient descent).
- Overrides:
iterate
in class BiasedMatrixFactorization
- Parameters:
rating_indices
- a list of indices pointing to the ratings to iterate overupdate_user
- true if user factors to be updatedupdate_item
- true if item factors to be updated
computeLoss
public double computeLoss()
- Description copied from class:
MatrixFactorization
- Compute the regularized loss.
- Specified by:
computeLoss
in interface IIterativeModel
- Overrides:
computeLoss
in class MatrixFactorization
- Returns:
- the regularized loss
toString
public java.lang.String toString()
- Return a string representation of the recommender
- Specified by:
toString
in interface IRecommender
- Overrides:
toString
in class BiasedMatrixFactorization
- Returns:
- the class name and all hyperparameters, separated by space characters.