C# 클래스 MyMediaLite.RatingPrediction.MatrixFactorization

Simple matrix factorization class, learning is performed by stochastic gradient descent (SGD)

Factorizing the observed rating values using a factor matrix for users and one for items.

NaN values in the model occur if values become too large or too small to be represented by the type float. If you encounter such problems, there are three ways to fix them: (1) (preferred) Use BiasedMatrixFactorization, which is more stable. (2) Change the range of rating values (1 to 5 works generally well with the default settings). (3) Decrease the learn_rate.

This recommender supports incremental updates.

상속: MyMediaLite.RatingPrediction.IncrementalRatingPredictor, IIterativeModel, IFoldInRatingPredictor
파일 보기 프로젝트 열기: zenogantner/MML-KDD 1 사용 예제들

보호된 프로퍼티들

프로퍼티 타입 설명
global_bias double
item_factors Matrix
user_factors Matrix

공개 메소드들

메소드 설명
AddRating ( int user_id, int item_id, double rating ) : void
ComputeFit ( ) : double
ComputeLoss ( ) : double

Compute the regularized loss

Iterate ( ) : void
LoadModel ( string filename ) : void
MatrixFactorization ( ) : System

Default constructor

Predict ( int user_id, int item_id ) : double

Predict the rating of a given user for a given item

If the user or the item are not known to the recommender, the global average is returned. To avoid this behavior for unknown entities, use CanPredict() to check before.

RemoveItem ( int item_id ) : void
RemoveRating ( int user_id, int item_id ) : void
RemoveUser ( int user_id ) : void
RetrainItem ( int item_id ) : void

Updates the latent factors of an item

RetrainUser ( int user_id ) : void

Updates the latent factors on a user

SaveModel ( string filename ) : void
ToString ( ) : string
Train ( ) : void
UpdateRating ( int user_id, int item_id, double rating ) : void

보호된 메소드들

메소드 설명
AddItem ( int item_id ) : void
AddUser ( int user_id ) : void
InitModel ( ) : void

Initialize the model data structure

Iterate ( IList rating_indices, bool update_user, bool update_item ) : void

Iterate once over rating data and adjust corresponding factors (stochastic gradient descent)

Predict ( int user_id, int item_id, bool bound ) : double

비공개 메소드들

메소드 설명
LearnFactors ( IList rating_indices, bool update_user, bool update_item ) : void

메소드 상세

AddItem() 보호된 메소드

protected AddItem ( int item_id ) : void
item_id int
리턴 void

AddRating() 공개 메소드

public AddRating ( int user_id, int item_id, double rating ) : void
user_id int
item_id int
rating double
리턴 void

AddUser() 보호된 메소드

protected AddUser ( int user_id ) : void
user_id int
리턴 void

ComputeFit() 공개 메소드

public ComputeFit ( ) : double
리턴 double

ComputeLoss() 공개 메소드

Compute the regularized loss
public ComputeLoss ( ) : double
리턴 double

InitModel() 보호된 메소드

Initialize the model data structure
protected InitModel ( ) : void
리턴 void

Iterate() 공개 메소드

public Iterate ( ) : void
리턴 void

Iterate() 보호된 메소드

Iterate once over rating data and adjust corresponding factors (stochastic gradient descent)
protected Iterate ( IList rating_indices, bool update_user, bool update_item ) : void
rating_indices IList a list of indices pointing to the ratings to iterate over
update_user bool true if user factors to be updated
update_item bool true if item factors to be updated
리턴 void

LoadModel() 공개 메소드

public LoadModel ( string filename ) : void
filename string
리턴 void

MatrixFactorization() 공개 메소드

Default constructor
public MatrixFactorization ( ) : System
리턴 System

Predict() 공개 메소드

Predict the rating of a given user for a given item
If the user or the item are not known to the recommender, the global average is returned. To avoid this behavior for unknown entities, use CanPredict() to check before.
public Predict ( int user_id, int item_id ) : double
user_id int the user ID
item_id int the item ID
리턴 double

Predict() 보호된 메소드

protected Predict ( int user_id, int item_id, bool bound ) : double
user_id int
item_id int
bound bool
리턴 double

RemoveItem() 공개 메소드

public RemoveItem ( int item_id ) : void
item_id int
리턴 void

RemoveRating() 공개 메소드

public RemoveRating ( int user_id, int item_id ) : void
user_id int
item_id int
리턴 void

RemoveUser() 공개 메소드

public RemoveUser ( int user_id ) : void
user_id int
리턴 void

RetrainItem() 공개 메소드

Updates the latent factors of an item
public RetrainItem ( int item_id ) : void
item_id int the item ID
리턴 void

RetrainUser() 공개 메소드

Updates the latent factors on a user
public RetrainUser ( int user_id ) : void
user_id int the user ID
리턴 void

SaveModel() 공개 메소드

public SaveModel ( string filename ) : void
filename string
리턴 void

ToString() 공개 메소드

public ToString ( ) : string
리턴 string

Train() 공개 메소드

public Train ( ) : void
리턴 void

UpdateRating() 공개 메소드

public UpdateRating ( int user_id, int item_id, double rating ) : void
user_id int
item_id int
rating double
리턴 void

프로퍼티 상세

global_bias 보호되어 있는 프로퍼티

The bias (global average)
protected double global_bias
리턴 double

item_factors 보호되어 있는 프로퍼티

Matrix containing the latent item factors
protected Matrix item_factors
리턴 Matrix

user_factors 보호되어 있는 프로퍼티

Matrix containing the latent user factors
protected Matrix user_factors
리턴 Matrix