GClasses
GClasses::GImputeMissingVals Class Reference

#include <GTransform.h>

Inheritance diagram for GClasses::GImputeMissingVals:
GClasses::GIncrementalTransform GClasses::GTransform

Public Member Functions

 GImputeMissingVals ()
 General-purpose constructor. More...
 
 GImputeMissingVals (const GDomNode *pNode, GLearnerLoader &ll)
 Deserializing constructor. More...
 
virtual ~GImputeMissingVals ()
 
virtual GDomNode * serialize (GDom *pDoc) const
 Marshal this object into a DOM, which can then be converted to a variety of serial formats. More...
 
void setCollaborativeFilter (GCollaborativeFilter *pCF)
 Sets the collaborative filter used to impute missing values. Takes ownership of pCF. If no collaborative filter is set, the default is to use matrix factorization with some typical parameters. More...
 
void setLabels (const GMatrix *pLabels)
 Specify a label matrix that should be appended with the training data. This object will not delete pLabels. It is expected that pLabels will remain valid at least until after train is next called. More...
 
virtual void transform (const GVec &in, GVec &out)
 See the comment for GIncrementalTransform::transform. More...
 
virtual GMatrix * transformBatch (const GMatrix &in)
 Unlike most other transforms, this one assumes that the matrix passed to this method is the same that was used to train it. (This assumption is necessary in order to utilize the additional label information that may be available at training time, which can be important for imputation.) More...
 
virtual void untransform (const GVec &in, GVec &out)
 See the comment for GIncrementalTransform::untransform. More...
 
virtual void untransformToDistribution (const GVec &in, GPrediction *pOut)
 See the comment for GIncrementalTransform::untransformToDistribution. More...
 
- Public Member Functions inherited from GClasses::GIncrementalTransform
 GIncrementalTransform ()
 
 GIncrementalTransform (const GDomNode *pNode)
 
virtual ~GIncrementalTransform ()
 
const GRelation & after () const
 Returns a relation object describing the data after it is transformed. More...
 
const GRelation & before () const
 Returns a relation object describing the data before it is transformed. More...
 
GVec & innerBuf ()
 Returns a buffer of sufficient size to store an inner (transformed) vector. The caller should not to delete the buffer. The same buffer will be returned each time. More...
 
virtual GMatrix * reduce (const GMatrix &in)
 This calls train, then calls transformBatch, and returns the result. More...
 
void setAfter (GRelation *pRel)
 Sets the after relation. Takes ownership of pRel. More...
 
void setBefore (GRelation *pRel)
 Sets the before relation. Takes ownership of pRel. More...
 
void train (const GMatrix &data)
 Trains the transform on the data in pData. (This method may be a no-op for transformations that always behave in the same manner.) More...
 
void train (const GRelation &pRelation)
 "Trains" the transform without any data. More...
 
virtual std::unique_ptr< GMatrix > untransformBatch (const GMatrix &in)
 This assumes train was previously called, and untransforms all the rows in pIn and returns the results. More...
 
- Public Member Functions inherited from GClasses::GTransform
 GTransform ()
 
 GTransform (const GDomNode *pNode)
 
virtual ~GTransform ()
 

Protected Member Functions

virtual GRelation * trainInner (const GMatrix &data)
 See the comment for GIncrementalTransform::train. More...
 
virtual GRelation * trainInner (const GRelation &relation)
 Throws an exception (because this transform cannot be trained without data) More...
 
- Protected Member Functions inherited from GClasses::GIncrementalTransform
virtual GDomNode * baseDomNode (GDom *pDoc, const char *szClassName) const
 Child classes should use this in their implementation of serialize. More...
 

Protected Attributes

GMatrix * m_pBatch
 
GCollaborativeFilter * m_pCF
 
const GMatrix * m_pLabels
 
GNominalToCat * m_pNTC
 

Additional Inherited Members

- Static Public Member Functions inherited from GClasses::GIncrementalTransform
static void test ()
 Performs unit tests for this class. Throws an exception if there is a failure. More...
 

Constructor & Destructor Documentation

GClasses::GImputeMissingVals::GImputeMissingVals ( )

General-purpose constructor.

GClasses::GImputeMissingVals::GImputeMissingVals ( const GDomNode *  pNode,
GLearnerLoader &  ll 
)

Deserializing constructor.

virtual GClasses::GImputeMissingVals::~GImputeMissingVals ( )
virtual

Member Function Documentation

virtual GDomNode* GClasses::GImputeMissingVals::serialize ( GDom *  pDoc) const
virtual

Marshal this object into a DOM, which can then be converted to a variety of serial formats.

Implements GClasses::GIncrementalTransform.

void GClasses::GImputeMissingVals::setCollaborativeFilter ( GCollaborativeFilter *  pCF)

Sets the collaborative filter used to impute missing values. Takes ownership of pCF. If no collaborative filter is set, the default is to use matrix factorization with some typical parameters.

void GClasses::GImputeMissingVals::setLabels ( const GMatrix *  pLabels)

Specify a label matrix that should be appended with the training data. This object will not delete pLabels. It is expected that pLabels will remain valid at least until after train is next called.

virtual GRelation* GClasses::GImputeMissingVals::trainInner ( const GMatrix &  data)
protectedvirtual
virtual GRelation* GClasses::GImputeMissingVals::trainInner ( const GRelation &  relation)
protectedvirtual

Throws an exception (because this transform cannot be trained without data)

Implements GClasses::GIncrementalTransform.

virtual void GClasses::GImputeMissingVals::transform ( const GVec &  in,
GVec &  out 
)
virtual
virtual GMatrix* GClasses::GImputeMissingVals::transformBatch ( const GMatrix &  in)
virtual

Unlike most other transforms, this one assumes that the matrix passed to this method is the same that was used to train it. (This assumption is necessary in order to utilize the additional label information that may be available at training time, which can be important for imputation.)

Reimplemented from GClasses::GIncrementalTransform.

virtual void GClasses::GImputeMissingVals::untransform ( const GVec &  in,
GVec &  out 
)
virtual
virtual void GClasses::GImputeMissingVals::untransformToDistribution ( const GVec &  in,
GPrediction *  pOut 
)
virtual

Member Data Documentation

GMatrix* GClasses::GImputeMissingVals::m_pBatch
protected
GCollaborativeFilter* GClasses::GImputeMissingVals::m_pCF
protected
const GMatrix* GClasses::GImputeMissingVals::m_pLabels
protected
GNominalToCat* GClasses::GImputeMissingVals::m_pNTC
protected