GClasses
|
This class trains a neural network to fit to the ratings. Although the name implies that it is an extension of PCA, I think it is better described as a non-linear generalization of matrix factorization. This algorithm was published in Scholz, M. Kaplan, F. Guy, C. L. Kopka, J. Selbig, J., Non-linear PCA: a missing data approach, In Bioinformatics, Vol. 21, Number 20, pp. 3887-3895, Oxford University Press, 2005. More...
#include <GRecommender.h>
Public Member Functions | |
GNonlinearPCA (size_t intrinsicDims, GRand &rand) | |
General-purpose constructor. | |
GNonlinearPCA (GDomNode *pNode, GLearnerLoader &ll) | |
Deserialization constructor. | |
virtual | ~GNonlinearPCA () |
Destructor. | |
GNeuralNet * | model () |
Returns a pointer to the neural net that is used to model the recommendation space. You may want to use this method to add hidden layers, set the learning rate, or change activation functions before the model is trained. | |
GMatrix * | users () |
Returns a pointer to the matrix of user preference vectors. | |
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. | |
virtual GDomNode * | serialize (GDom *pDoc) |
See the comment for GCollaborativeFilter::serialize. | |
void | noInputBias () |
Specify to use no bias value with the inputs. | |
void | noThreePass () |
Specify not to use three-pass training. (It will just use one pass instead.) | |
Static Public Member Functions | |
static void | test () |
Performs unit tests. Throws if a failure occurs. Returns if successful. | |
Protected Member Functions | |
double | validate (GNeuralNet *pNN, GMatrix &data) |
Returns the sum-squared error for the specified set of ratings. | |
Protected Attributes | |
size_t | m_intrinsicDims |
size_t | m_items |
double * | m_pMins |
double * | m_pMaxs |
GNeuralNet * | m_pModel |
GMatrix * | m_pUsers |
bool | m_useInputBias |
bool | m_useThreePass |
This class trains a neural network to fit to the ratings. Although the name implies that it is an extension of PCA, I think it is better described as a non-linear generalization of matrix factorization. This algorithm was published in Scholz, M. Kaplan, F. Guy, C. L. Kopka, J. Selbig, J., Non-linear PCA: a missing data approach, In Bioinformatics, Vol. 21, Number 20, pp. 3887-3895, Oxford University Press, 2005.
GClasses::GNonlinearPCA::GNonlinearPCA | ( | size_t | intrinsicDims, |
GRand & | rand | ||
) |
General-purpose constructor.
GClasses::GNonlinearPCA::GNonlinearPCA | ( | GDomNode * | pNode, |
GLearnerLoader & | ll | ||
) |
Deserialization constructor.
virtual GClasses::GNonlinearPCA::~GNonlinearPCA | ( | ) | [virtual] |
Destructor.
virtual void GClasses::GNonlinearPCA::impute | ( | double * | pVec, |
size_t | dims | ||
) | [virtual] |
See the comment for GCollaborativeFilter::impute.
Implements GClasses::GCollaborativeFilter.
GNeuralNet* GClasses::GNonlinearPCA::model | ( | ) | [inline] |
Returns a pointer to the neural net that is used to model the recommendation space. You may want to use this method to add hidden layers, set the learning rate, or change activation functions before the model is trained.
void GClasses::GNonlinearPCA::noInputBias | ( | ) | [inline] |
Specify to use no bias value with the inputs.
void GClasses::GNonlinearPCA::noThreePass | ( | ) | [inline] |
Specify not to use three-pass training. (It will just use one pass instead.)
virtual double GClasses::GNonlinearPCA::predict | ( | size_t | user, |
size_t | item | ||
) | [virtual] |
See the comment for GCollaborativeFilter::predict.
Implements GClasses::GCollaborativeFilter.
See the comment for GCollaborativeFilter::serialize.
Implements GClasses::GCollaborativeFilter.
static void GClasses::GNonlinearPCA::test | ( | ) | [static] |
Performs unit tests. Throws if a failure occurs. Returns if successful.
virtual void GClasses::GNonlinearPCA::train | ( | GMatrix & | data | ) | [virtual] |
See the comment for GCollaborativeFilter::train.
Implements GClasses::GCollaborativeFilter.
GMatrix* GClasses::GNonlinearPCA::users | ( | ) | [inline] |
Returns a pointer to the matrix of user preference vectors.
double GClasses::GNonlinearPCA::validate | ( | GNeuralNet * | pNN, |
GMatrix & | data | ||
) | [protected] |
Returns the sum-squared error for the specified set of ratings.
size_t GClasses::GNonlinearPCA::m_intrinsicDims [protected] |
size_t GClasses::GNonlinearPCA::m_items [protected] |
double* GClasses::GNonlinearPCA::m_pMaxs [protected] |
double* GClasses::GNonlinearPCA::m_pMins [protected] |
GNeuralNet* GClasses::GNonlinearPCA::m_pModel [protected] |
GMatrix* GClasses::GNonlinearPCA::m_pUsers [protected] |
bool GClasses::GNonlinearPCA::m_useInputBias [protected] |
bool GClasses::GNonlinearPCA::m_useThreePass [protected] |