GClasses

GClasses::GMatrixFactorization Class Reference

This factors the sparse matrix of ratings, M, such that M = PQ^T where each row in P gives the principal preferences for the corresponding user, and each row in Q gives the linear combination of those preferences that map to a rating for an item. (Actually, P and Q also contain an extra column added for a bias.) This class is implemented according to the specification on page 631 in Takacs, G., Pilaszy, I., Nemeth, B., and Tikk, D. Scalable collaborative filtering approaches for large recommender systems. The Journal of Machine Learning Research, 10:623–656, 2009. ISSN 1532-4435., except with the addition of learning-rate decay and a different stopping criteria. More...

#include <GRecommender.h>

Inheritance diagram for GClasses::GMatrixFactorization:
GClasses::GCollaborativeFilter

List of all members.

Public Member Functions

 GMatrixFactorization (size_t intrinsicDims, GRand &rand)
 General-purpose constructor.
 GMatrixFactorization (GDomNode *pNode, GLearnerLoader &ll)
 Deserialization constructor.
virtual ~GMatrixFactorization ()
 Destructor.
void setRegularizer (double d)
 Set the regularization value.
virtual void train (GMatrix &data)
 See the comment for GCollaborativeFilter::train.
virtual double predict (size_t user, size_t item)
 See the comment for GCollaborativeFilter::predict.
virtual void impute (double *pVec, size_t dims)
 See the comment for GCollaborativeFilter::impute.
GMatrixgetP ()
 Returns the matrix of user preference vectors.
GMatrixgetQ ()
 Returns the matrix of item weight vectors.
virtual GDomNodeserialize (GDom *pDoc)
 See the comment for GCollaborativeFilter::serialize.
void noInputBias ()
 Specify to use no bias value with the inputs.

Static Public Member Functions

static void test ()
 Performs unit tests. Throws if a failure occurs. Returns if successful.

Protected Member Functions

double validate (GMatrix &data)
 Returns the sum-squared error for the specified set of ratings.

Protected Attributes

size_t m_intrinsicDims
double m_regularizer
GMatrixm_pP
GMatrixm_pQ
bool m_useInputBias

Detailed Description

This factors the sparse matrix of ratings, M, such that M = PQ^T where each row in P gives the principal preferences for the corresponding user, and each row in Q gives the linear combination of those preferences that map to a rating for an item. (Actually, P and Q also contain an extra column added for a bias.) This class is implemented according to the specification on page 631 in Takacs, G., Pilaszy, I., Nemeth, B., and Tikk, D. Scalable collaborative filtering approaches for large recommender systems. The Journal of Machine Learning Research, 10:623–656, 2009. ISSN 1532-4435., except with the addition of learning-rate decay and a different stopping criteria.


Constructor & Destructor Documentation

GClasses::GMatrixFactorization::GMatrixFactorization ( size_t  intrinsicDims,
GRand rand 
)

General-purpose constructor.

GClasses::GMatrixFactorization::GMatrixFactorization ( GDomNode pNode,
GLearnerLoader ll 
)

Deserialization constructor.

virtual GClasses::GMatrixFactorization::~GMatrixFactorization ( ) [virtual]

Destructor.


Member Function Documentation

GMatrix* GClasses::GMatrixFactorization::getP ( ) [inline]

Returns the matrix of user preference vectors.

GMatrix* GClasses::GMatrixFactorization::getQ ( ) [inline]

Returns the matrix of item weight vectors.

virtual void GClasses::GMatrixFactorization::impute ( double *  pVec,
size_t  dims 
) [virtual]
void GClasses::GMatrixFactorization::noInputBias ( ) [inline]

Specify to use no bias value with the inputs.

virtual double GClasses::GMatrixFactorization::predict ( size_t  user,
size_t  item 
) [virtual]
virtual GDomNode* GClasses::GMatrixFactorization::serialize ( GDom pDoc) [virtual]
void GClasses::GMatrixFactorization::setRegularizer ( double  d) [inline]

Set the regularization value.

static void GClasses::GMatrixFactorization::test ( ) [static]

Performs unit tests. Throws if a failure occurs. Returns if successful.

virtual void GClasses::GMatrixFactorization::train ( GMatrix data) [virtual]
double GClasses::GMatrixFactorization::validate ( GMatrix data) [protected]

Returns the sum-squared error for the specified set of ratings.


Member Data Documentation