C# Class MyMediaLite.RatingPrediction.UserItemBaseline

Baseline method for rating prediction

Uses the average rating value, plus a regularized user and item bias for prediction.

The method was described in section 2.1 of the paper below. One difference is that we support several iterations of alternating optimization, instead of just one.

The optimization problem solved by the Train() method is the following: \f[ \min_{\mathbf{a}, \mathbf{b}} \sum_{(u, i, r) \in R} (r - \mu_R - a_u - b_i)^2 + \lambda_1 \|\mathbf{a}\|^2 + \lambda_2 \|\mathbf{b}\|^2, \f] where \f$R\f$ are the known ratings, and \f$\lambda_1\f$ and \f$\lambda_2\f$ are the regularization constants RegU and RegI. The sum represents the least squares error, while the two terms starting with \f$\lambda_1\f$ and \f$\lambda_2\f$, respectively, are regularization terms that control the parameter sizes to avoid overfitting. The optimization problem is solved an alternating least squares method.

Literature: Yehuda Koren: Factor in the Neighbors: Scalable and Accurate Collaborative Filtering, Transactions on Knowledge Discovery from Data (TKDD), 2009. http://public.research.att.com/~volinsky/netflix/factorizedNeighborhood.pdf

This recommender supports incremental updates.

Inheritance: MyMediaLite.RatingPrediction.IncrementalRatingPredictor, IIterativeModel
Exibir arquivo Open project: zenogantner/MML-KDD Class Usage Examples

Public Methods

Method Description
AddRating ( int user_id, int item_id, double rating ) : void
ComputeFit ( ) : double
Iterate ( ) : void
LoadModel ( string filename ) : void
Predict ( int user_id, int item_id ) : double
RemoveRating ( int user_id, int item_id ) : void
SaveModel ( string filename ) : void
ToString ( ) : string
Train ( ) : void
UpdateRating ( int user_id, int item_id, double rating ) : void
UserItemBaseline ( ) : System

Default constructor

Protected Methods

Method Description
AddItem ( int item_id ) : void
AddUser ( int user_id ) : void
RetrainItem ( int item_id ) : void
RetrainUser ( int user_id ) : void

Private Methods

Method Description
OptimizeItemBiases ( ) : void
OptimizeUserBiases ( ) : void

Method Details

AddItem() protected method

protected AddItem ( int item_id ) : void
item_id int
return void

AddRating() public method

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

AddUser() protected method

protected AddUser ( int user_id ) : void
user_id int
return void

ComputeFit() public method

public ComputeFit ( ) : double
return double

Iterate() public method

public Iterate ( ) : void
return void

LoadModel() public method

public LoadModel ( string filename ) : void
filename string
return void

Predict() public method

public Predict ( int user_id, int item_id ) : double
user_id int
item_id int
return double

RemoveRating() public method

public RemoveRating ( int user_id, int item_id ) : void
user_id int
item_id int
return void

RetrainItem() protected method

protected RetrainItem ( int item_id ) : void
item_id int
return void

RetrainUser() protected method

protected RetrainUser ( int user_id ) : void
user_id int
return void

SaveModel() public method

public SaveModel ( string filename ) : void
filename string
return void

ToString() public method

public ToString ( ) : string
return string

Train() public method

public Train ( ) : void
return void

UpdateRating() public method

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

UserItemBaseline() public method

Default constructor
public UserItemBaseline ( ) : System
return System