MyMediaLite  3.11
Public Member Functions | Protected Member Functions | Protected Attributes | Properties | List of all members
TimeAwareBaselineWithFrequencies Class Reference

Time-aware bias model with frequencies More...

Inheritance diagram for TimeAwareBaselineWithFrequencies:
TimeAwareBaseline TimeAwareRatingPredictor IIterativeModel RatingPredictor ITimeAwareRatingPredictor Recommender IRatingPredictor IRatingPredictor IRecommender IRecommender IRecommender

Public Member Functions

virtual bool CanPredict (int user_id, int item_id)
 Check whether a useful prediction (i.e. not using a fallback/default answer) can be made for a given user-item combination More...
 
Object Clone ()
 create a shallow copy of the object More...
 
override float ComputeObjective ()
 Compute the current optimization objective (usually loss plus regularization term) of the model More...
 
virtual void Iterate ()
 Run one iteration (= pass over the training data) More...
 
virtual void LoadModel (string file)
 Get the model parameters from a file More...
 
override float Predict (int user_id, int item_id, DateTime time)
 predict rating at a certain point in time More...
 
override float Predict (int user_id, int item_id)
 Predict rating or score for a given user-item combination More...
 
IList< Tuple< int, float > > Recommend (int user_id, int n=-1, ICollection< int > ignore_items=null, ICollection< int > candidate_items=null)
 Recommend items for a given user More...
 
virtual System.Collections.Generic.IList< Tuple< int, float > > Recommend (int user_id, int n=-1, System.Collections.Generic.ICollection< int > ignore_items=null, System.Collections.Generic.ICollection< int > candidate_items=null)
 
virtual void SaveModel (string file)
 Save the model parameters to a file More...
 
 TimeAwareBaselineWithFrequencies ()
 Default constructor More...
 
override string ToString ()
 Return a string representation of the recommender More...
 
override void Train ()
 Learn the model parameters of the recommender from the training data More...
 

Protected Member Functions

override void InitModel ()
 Initialize the model parameters More...
 
override float Predict (int user_id, int item_id, int day, int bin)
 Predict the specified user_id, item_id, day and bin More...
 
int RelativeDay (DateTime datetime)
 Given a DateTime object, return the day relative to the first rating day in the dataset More...
 
override void UpdateParameters (int u, int i, int day, int bin, float err)
 Single stochastic gradient descent step: update the parameter values for one user and one item More...
 

Protected Attributes

int latest_relative_day
 last day in the training data, counting from the first day More...
 
float max_rating
 Maximum rating value More...
 
float min_rating
 Minimum rating value More...
 
IRatings ratings
 rating data More...
 
ITimedRatings timed_ratings
 rating data, including time information More...
 

Properties

float AlphaLearnRate [get, set]
 learn rate for the user-wise alphas More...
 
float Beta [get, set]
 beta parameter for modeling the drift in the user bias More...
 
int BinSize [get, set]
 bin size in days for modeling the time-dependent item bias More...
 
float FrequencyLogBase [get, set]
 logarithmic base for the frequency counts More...
 
float ItemBiasAtFrequencyLearnRate [get, set]
 learn rate for b_{i, f_{ui}} More...
 
float ItemBiasByTimeBinLearnRate [get, set]
 learn rate for the bin-wise item bias More...
 
float ItemBiasLearnRate [get, set]
 learn rate for the item bias More...
 
int MaxItemID [get, set]
 Maximum item ID More...
 
virtual float MaxRating [get, set]
 Maximum rating value More...
 
int MaxUserID [get, set]
 Maximum user ID More...
 
virtual float MinRating [get, set]
 Minimum rating value More...
 
uint NumIter [get, set]
 number of iterations over the dataset to perform More...
 
override IRatings Ratings [get, set]
 
float RegAlpha [get, set]
 regularization for the user-wise alphas More...
 
float RegI [get, set]
 regularization for the item bias More...
 
float RegItemBiasAtFrequency [get, set]
 regularization constant for b_{i, f_{ui}} More...
 
float RegItemBiasByTimeBin [get, set]
 regularization for the bin-wise item bias More...
 
float RegU [get, set]
 regularization for the user bias More...
 
float RegUserBiasByDay [get, set]
 regularization for the day-wise user bias More...
 
float RegUserScaling [get, set]
 regularization for the user scaling factor More...
 
float RegUserScalingByDay [get, set]
 regularization for the day-wise user scaling factor More...
 
virtual ITimedRatings TimedRatings [get, set]
 the rating data, including time information More...
 
float UserBiasByDayLearnRate [get, set]
 learn rate for the day-wise user bias More...
 
float UserBiasLearnRate [get, set]
 learn rate for the user bias More...
 
float UserScalingByDayLearnRate [get, set]
 learn rate for the day-wise user scaling factor More...
 
float UserScalingLearnRate [get, set]
 learn rate for the user-wise scaling factor More...
 

Detailed Description

Time-aware bias model with frequencies

Model described in equation (11) of BellKor Grand Prize documentation for the Netflix Prize (see below).

The default hyper-parameter values are set to the ones shown in the report. For datasets other than Netflix, you may want to find better parameters.

Literature:

This recommender does currently NOT support incremental updates.

Constructor & Destructor Documentation

Default constructor

Member Function Documentation

virtual bool CanPredict ( int  user_id,
int  item_id 
)
inlinevirtualinherited

Check whether a useful prediction (i.e. not using a fallback/default answer) can be made for a given user-item combination

It is up to the recommender implementor to decide when a prediction is useful, and to document it accordingly.

Parameters
user_idthe user ID
item_idthe item ID
Returns
true if a useful prediction can be made, false otherwise

Implements IRecommender.

Reimplemented in ExternalItemRecommender, ExternalRatingPredictor, BiPolarSlopeOne, SlopeOne, Constant, GlobalAverage, UserAverage, ItemAverage, and Random.

Object Clone ( )
inlineinherited

create a shallow copy of the object

override float ComputeObjective ( )
inlinevirtual

Compute the current optimization objective (usually loss plus regularization term) of the model

Returns
the current objective; -1 if not implemented

Reimplemented from TimeAwareBaseline.

override void InitModel ( )
inlineprotectedvirtual

Initialize the model parameters

Reimplemented from TimeAwareBaseline.

virtual void Iterate ( )
inlinevirtualinherited

Run one iteration (= pass over the training data)

Implements IIterativeModel.

virtual void LoadModel ( string  filename)
inlinevirtualinherited
override float Predict ( int  user_id,
int  item_id,
int  day,
int  bin 
)
inlineprotectedvirtual

Predict the specified user_id, item_id, day and bin

Assumes user and item IDs are valid.

Parameters
user_idthe user ID
item_idthe item ID
daythe day of the rating
binthe day bin of the rating

Reimplemented from TimeAwareBaseline.

override float Predict ( int  user_id,
int  item_id,
DateTime  time 
)
inlinevirtual

predict rating at a certain point in time

Parameters
user_idthe user ID
item_idthe item ID
timethe time of the rating event

Reimplemented from TimeAwareBaseline.

override float Predict ( int  user_id,
int  item_id 
)
inlinevirtualinherited

Predict rating or score for a given user-item combination

Parameters
user_idthe user ID
item_idthe item ID
Returns
the predicted score/rating for the given user-item combination

Implements Recommender.

IList<Tuple<int, float> > Recommend ( int  user_id,
int  n = -1,
ICollection< int >  ignore_items = null,
ICollection< int >  candidate_items = null 
)
inherited

Recommend items for a given user

Parameters
user_idthe user ID
nthe number of items to recommend, -1 for as many as possible
ignore_itemscollection if items that should not be returned; if null, use empty collection
candidate_itemsthe candidate items to choose from; if null, use all items
Returns
a sorted list of (item_id, score) tuples

Implemented in WeightedEnsemble, and Ensemble.

int RelativeDay ( DateTime  datetime)
inlineprotectedinherited

Given a DateTime object, return the day relative to the first rating day in the dataset

Returns
the day relative to the first rating day in the dataset
Parameters
datetimethe date/time of the rating event
virtual void SaveModel ( string  filename)
inlinevirtualinherited
override string ToString ( )
inline

Return a string representation of the recommender

The ToString() method of recommenders should list the class name and all hyperparameters, separated by space characters.

Implements IRecommender.

override void Train ( )
inlinevirtual

Learn the model parameters of the recommender from the training data

Reimplemented from TimeAwareBaseline.

override void UpdateParameters ( int  u,
int  i,
int  day,
int  bin,
float  err 
)
inlineprotectedvirtual

Single stochastic gradient descent step: update the parameter values for one user and one item

Parameters
uthe user ID
ithe item ID
daythe day of the rating
binthe day bin of the rating
errthe current error made for this rating

Reimplemented from TimeAwareBaseline.

Member Data Documentation

int latest_relative_day
protectedinherited

last day in the training data, counting from the first day

float max_rating
protectedinherited

Maximum rating value

float min_rating
protectedinherited

Minimum rating value

IRatings ratings
protectedinherited

rating data

ITimedRatings timed_ratings
protectedinherited

rating data, including time information

Property Documentation

float AlphaLearnRate
getsetinherited

learn rate for the user-wise alphas

float Beta
getsetinherited

beta parameter for modeling the drift in the user bias

int BinSize
getsetinherited

bin size in days for modeling the time-dependent item bias

float FrequencyLogBase
getset

logarithmic base for the frequency counts

float ItemBiasAtFrequencyLearnRate
getset

learn rate for b_{i, f_{ui}}

float ItemBiasByTimeBinLearnRate
getsetinherited

learn rate for the bin-wise item bias

float ItemBiasLearnRate
getsetinherited

learn rate for the item bias

int MaxItemID
getsetinherited

Maximum item ID

virtual float MaxRating
getsetinherited

Maximum rating value

int MaxUserID
getsetinherited

Maximum user ID

virtual float MinRating
getsetinherited

Minimum rating value

uint NumIter
getsetinherited

number of iterations over the dataset to perform

float RegAlpha
getsetinherited

regularization for the user-wise alphas

float RegI
getsetinherited

regularization for the item bias

float RegItemBiasAtFrequency
getset

regularization constant for b_{i, f_{ui}}

float RegItemBiasByTimeBin
getsetinherited

regularization for the bin-wise item bias

float RegU
getsetinherited

regularization for the user bias

float RegUserBiasByDay
getsetinherited

regularization for the day-wise user bias

float RegUserScaling
getsetinherited

regularization for the user scaling factor

float RegUserScalingByDay
getsetinherited

regularization for the day-wise user scaling factor

virtual ITimedRatings TimedRatings
getsetinherited

the rating data, including time information

float UserBiasByDayLearnRate
getsetinherited

learn rate for the day-wise user bias

float UserBiasLearnRate
getsetinherited

learn rate for the user bias

float UserScalingByDayLearnRate
getsetinherited

learn rate for the day-wise user scaling factor

float UserScalingLearnRate
getsetinherited

learn rate for the user-wise scaling factor


The documentation for this class was generated from the following file: