GClasses
|
This is the base class of algorithms that can transform data one row at a time without supervision.
#include <GTransform.h>
Public Member Functions | |
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... | |
virtual GDomNode * | serialize (GDom *pDoc) const =0 |
Marshal this object into a DOM, which can then be converted to a variety of serial formats. 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 void | transform (const GVec &in, GVec &out)=0 |
pIn is the source row. pOut is a buffer that will hold the transformed row. train must be called before this method is used More... | |
virtual GMatrix * | transformBatch (const GMatrix &in) |
This assumes that train has already been called, and transforms all the rows in in returning the resulting matrix. The caller is responsible for deleting the new matrix. More... | |
virtual void | untransform (const GVec &in, GVec &out)=0 |
pIn is a previously transformed row, and pOut is a buffer that will hold the untransformed row. train must be called before this method is used. This method may throw an exception if this transformation cannot be undone or approximately undone. 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... | |
virtual void | untransformToDistribution (const GVec &in, GPrediction *pOut)=0 |
Similar to untransform, except it produces a distribution instead of just a vector. This method may not be implemented in all classes, so it may throw an exception. More... | |
Public Member Functions inherited from GClasses::GTransform | |
GTransform () | |
GTransform (const GDomNode *pNode) | |
virtual | ~GTransform () |
Static Public Member Functions | |
static void | test () |
Performs unit tests for this class. Throws an exception if there is a failure. More... | |
Protected Member Functions | |
virtual GDomNode * | baseDomNode (GDom *pDoc, const char *szClassName) const |
Child classes should use this in their implementation of serialize. More... | |
virtual GRelation * | trainInner (const GMatrix &data)=0 |
This method implements the functionality called by train. The data passed in may be used to guide training. This method returns a smart-pointer to a relation the represents the form that the data will take after it is transformed. More... | |
virtual GRelation * | trainInner (const GRelation &relation)=0 |
This method implements the functionality called by train. This method is called to initialize the transform when it is used with an incremental learner. Transforms that cannot be trained without available data may throw an exception in this method. The relation passed in represents the form that the input data will have. This method returns a smart-pointer to a relation the represents the form that the data will take after it is transformed. More... | |
|
inline |
GClasses::GIncrementalTransform::GIncrementalTransform | ( | const GDomNode * | pNode | ) |
|
virtual |
|
inline |
Returns a relation object describing the data after it is transformed.
train must be called before this method is used
|
protectedvirtual |
Child classes should use this in their implementation of serialize.
Reimplemented from GClasses::GTransform.
|
inline |
Returns a relation object describing the data before it is transformed.
train must be called before this method is used
GVec& GClasses::GIncrementalTransform::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.
This calls train, then calls transformBatch, and returns the result.
Implements GClasses::GTransform.
Reimplemented in GClasses::GSelfOrganizingMap.
Marshal this object into a DOM, which can then be converted to a variety of serial formats.
Implemented in GClasses::GSelfOrganizingMap, GClasses::GLogify, GClasses::GImputeMissingVals, GClasses::GDiscretize, GClasses::GNormalize, GClasses::GNominalToCat, GClasses::GAttributeSelector, GClasses::GDataAugmenter, GClasses::GReservoir, GClasses::GPairProduct, GClasses::GNoiseGenerator, GClasses::GPCA, and GClasses::GIncrementalTransformChainer.
void GClasses::GIncrementalTransform::setAfter | ( | GRelation * | pRel | ) |
Sets the after relation. Takes ownership of pRel.
void GClasses::GIncrementalTransform::setBefore | ( | GRelation * | pRel | ) |
Sets the before relation. Takes ownership of pRel.
|
static |
Performs unit tests for this class. Throws an exception if there is a failure.
void GClasses::GIncrementalTransform::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.)
void GClasses::GIncrementalTransform::train | ( | const GRelation & | pRelation | ) |
"Trains" the transform without any data.
This method is called to initialize the transform when it is used with an incremental learner. Transforms that cannot be trained without available data may throw an exception in this method.
|
protectedpure virtual |
This method implements the functionality called by train. The data passed in may be used to guide training. This method returns a smart-pointer to a relation the represents the form that the data will take after it is transformed.
Implemented in GClasses::GSelfOrganizingMap, GClasses::GLogify, GClasses::GImputeMissingVals, GClasses::GDiscretize, GClasses::GNormalize, GClasses::GNominalToCat, GClasses::GAttributeSelector, GClasses::GDataAugmenter, GClasses::GReservoir, GClasses::GPairProduct, GClasses::GNoiseGenerator, GClasses::GPCA, and GClasses::GIncrementalTransformChainer.
|
protectedpure virtual |
This method implements the functionality called by train. This method is called to initialize the transform when it is used with an incremental learner. Transforms that cannot be trained without available data may throw an exception in this method. The relation passed in represents the form that the input data will have. This method returns a smart-pointer to a relation the represents the form that the data will take after it is transformed.
Implemented in GClasses::GSelfOrganizingMap, GClasses::GLogify, GClasses::GImputeMissingVals, GClasses::GDiscretize, GClasses::GNormalize, GClasses::GNominalToCat, GClasses::GAttributeSelector, GClasses::GDataAugmenter, GClasses::GReservoir, GClasses::GPairProduct, GClasses::GNoiseGenerator, GClasses::GPCA, and GClasses::GIncrementalTransformChainer.
|
pure virtual |
pIn is the source row. pOut is a buffer that will hold the transformed row. train must be called before this method is used
Implemented in GClasses::GSelfOrganizingMap, GClasses::GLogify, GClasses::GImputeMissingVals, GClasses::GDiscretize, GClasses::GNormalize, GClasses::GNominalToCat, GClasses::GAttributeSelector, GClasses::GDataAugmenter, GClasses::GReservoir, GClasses::GPairProduct, GClasses::GNoiseGenerator, GClasses::GPCA, and GClasses::GIncrementalTransformChainer.
This assumes that train has already been called, and transforms all the rows in in returning the resulting matrix. The caller is responsible for deleting the new matrix.
Reimplemented in GClasses::GImputeMissingVals.
|
pure virtual |
pIn is a previously transformed row, and pOut is a buffer that will hold the untransformed row. train must be called before this method is used. This method may throw an exception if this transformation cannot be undone or approximately undone.
Implemented in GClasses::GSelfOrganizingMap, GClasses::GLogify, GClasses::GImputeMissingVals, GClasses::GDiscretize, GClasses::GNormalize, GClasses::GNominalToCat, GClasses::GAttributeSelector, GClasses::GDataAugmenter, GClasses::GReservoir, GClasses::GPairProduct, GClasses::GNoiseGenerator, GClasses::GPCA, and GClasses::GIncrementalTransformChainer.
|
virtual |
This assumes train was previously called, and untransforms all the rows in pIn and returns the results.
|
pure virtual |
Similar to untransform, except it produces a distribution instead of just a vector. This method may not be implemented in all classes, so it may throw an exception.
Implemented in GClasses::GSelfOrganizingMap, GClasses::GLogify, GClasses::GImputeMissingVals, GClasses::GDiscretize, GClasses::GNormalize, GClasses::GNominalToCat, GClasses::GAttributeSelector, GClasses::GDataAugmenter, GClasses::GReservoir, GClasses::GPairProduct, GClasses::GNoiseGenerator, GClasses::GPCA, and GClasses::GIncrementalTransformChainer.