GClasses
|
This is sort-of the opposite of discretize. It converts each nominal attribute to a categorical distribution by representing each value using the corresponding row of the identity matrix. For example, if a certain nominal attribute has 4 possible values, then a value of 3 would be encoded as the vector 0 0 1 0. When predictions are converted back to nominal values, the mode of the categorical distribution is used as the predicted value. (This is similar to Weka's NominalToBinaryFilter.) More...
#include <GTransform.h>
Public Member Functions | |
GNominalToCat (size_t valueCap=12) | |
GNominalToCat (GDomNode *pNode, GLearnerLoader &ll) | |
Load from a DOM. | |
virtual | ~GNominalToCat () |
virtual GDomNode * | serialize (GDom *pDoc) |
Marshal this object into a DOM, which can then be converted to a variety of serial formats. | |
virtual void | train (GMatrix &data) |
See the comment for GIncrementalTransform::train. | |
virtual void | transform (const double *pIn, double *pOut) |
See the comment for GIncrementalTransform::transform. | |
virtual void | untransform (const double *pIn, double *pOut) |
See the comment for GTwoWayIncrementalTransform::untransform. | |
virtual void | untransformToDistribution (const double *pIn, GPrediction *pOut) |
See the comment for GTwoWayIncrementalTransform::untransformToDistribution. | |
void | reverseAttrMap (std::vector< size_t > &rmap) |
Makes a mapping from the post-transform attribute indexes to the pre-transform attribute indexes. | |
void | preserveUnknowns () |
Specify to preserve unknown values. That is, an unknown nominal value will be converted to a distribution of all unknown real values. | |
Protected Member Functions | |
void | init (sp_relation &pRelationBefore) |
Protected Attributes | |
size_t | m_valueCap |
GRand * | m_pRand |
std::vector< size_t > | m_ranks |
bool | m_preserveUnknowns |
This is sort-of the opposite of discretize. It converts each nominal attribute to a categorical distribution by representing each value using the corresponding row of the identity matrix. For example, if a certain nominal attribute has 4 possible values, then a value of 3 would be encoded as the vector 0 0 1 0. When predictions are converted back to nominal values, the mode of the categorical distribution is used as the predicted value. (This is similar to Weka's NominalToBinaryFilter.)
GClasses::GNominalToCat::GNominalToCat | ( | size_t | valueCap = 12 | ) |
GClasses::GNominalToCat::GNominalToCat | ( | GDomNode * | pNode, |
GLearnerLoader & | ll | ||
) |
Load from a DOM.
virtual GClasses::GNominalToCat::~GNominalToCat | ( | ) | [virtual] |
void GClasses::GNominalToCat::init | ( | sp_relation & | pRelationBefore | ) | [protected] |
void GClasses::GNominalToCat::preserveUnknowns | ( | ) | [inline] |
Specify to preserve unknown values. That is, an unknown nominal value will be converted to a distribution of all unknown real values.
void GClasses::GNominalToCat::reverseAttrMap | ( | std::vector< size_t > & | rmap | ) |
Makes a mapping from the post-transform attribute indexes to the pre-transform attribute indexes.
Marshal this object into a DOM, which can then be converted to a variety of serial formats.
Implements GClasses::GIncrementalTransform.
virtual void GClasses::GNominalToCat::train | ( | GMatrix & | data | ) | [virtual] |
See the comment for GIncrementalTransform::train.
Implements GClasses::GIncrementalTransform.
virtual void GClasses::GNominalToCat::transform | ( | const double * | pIn, |
double * | pOut | ||
) | [virtual] |
See the comment for GIncrementalTransform::transform.
Implements GClasses::GIncrementalTransform.
virtual void GClasses::GNominalToCat::untransform | ( | const double * | pIn, |
double * | pOut | ||
) | [virtual] |
See the comment for GTwoWayIncrementalTransform::untransform.
Implements GClasses::GTwoWayIncrementalTransform.
virtual void GClasses::GNominalToCat::untransformToDistribution | ( | const double * | pIn, |
GPrediction * | pOut | ||
) | [virtual] |
See the comment for GTwoWayIncrementalTransform::untransformToDistribution.
Implements GClasses::GTwoWayIncrementalTransform.
GRand* GClasses::GNominalToCat::m_pRand [protected] |
bool GClasses::GNominalToCat::m_preserveUnknowns [protected] |
std::vector<size_t> GClasses::GNominalToCat::m_ranks [protected] |
size_t GClasses::GNominalToCat::m_valueCap [protected] |