|
GClasses
|
This is a distribution that specifies a probability for each value in a set of nominal values.
#include <GDistribution.h>
Public Member Functions | |
| GCategoricalDistribution () | |
| virtual | ~GCategoricalDistribution () |
| void | deserialize (GDomNode *pNode) |
| Load values from a text format. More... | |
| double | entropy () |
| Returns the entropy of the values. More... | |
| virtual bool | isDiscrete () const |
| Returns true. More... | |
| virtual bool | isSupported (double x) const |
| Returns true if x is within the range of support. If x is not an integer, it will round x to the nearest integer and then return true if that value is supported. More... | |
| virtual double | likelihood (double x) |
| See the comment for GUnivariateDistribution::likelihood. More... | |
| virtual double | logLikelihood (double x) |
| See the comment for GUnivariateDistribution::logLikelihood. More... | |
| virtual double | mode () const |
| Returns the mode. More... | |
| void | normalize () |
| Makes the values sum to 1, and finds the mode. More... | |
| double | normalizedEntropy () |
| Computes the entropy of the values, normalized to fall between 0 and 1. More... | |
| void | normalizeFromLogSpace () |
| Safely converts from log space, and then normalizes. More... | |
| GDomNode * | serialize (GDom *pDoc) const |
| Save values to a text format. More... | |
| void | setBoolean (double d) |
| (1-d) is the probability of 0, and d is the probability of 1 More... | |
| void | setSpike (size_t nValueCount, size_t nValue, size_t nDepth) |
| This is a hack for when you know the mode but you don't know the other values. More... | |
| void | setToUniform (size_t nValues) |
| Set all uniform probabilities. More... | |
| void | setValues (size_t nValueCount, const double *pValues) |
| Sets the specified values, and normalizes. More... | |
| void | setValuesInferLast (size_t nValueCount, const double *pValues) |
| Sets the specified values, except infers the last, and normalizes. More... | |
| virtual Type | type () const |
| Returns categorical. More... | |
| size_t | valueCount () |
| Returns the number of supported values. More... | |
| GVec & | values (size_t nValueCount) |
| Resizes the vector of probabilities if it does not have nValueCount elements, and returns that vector. More... | |
Public Member Functions inherited from GClasses::GUnivariateDistribution | |
| GUnivariateDistribution () | |
| virtual | ~GUnivariateDistribution () |
Protected Attributes | |
| size_t | m_nMode |
| size_t | m_nValueCount |
| GVec | m_pValues |
Additional Inherited Members | |
Public Types inherited from GClasses::GUnivariateDistribution |
|
inline |
|
inlinevirtual |
| void GClasses::GCategoricalDistribution::deserialize | ( | GDomNode * | pNode | ) |
Load values from a text format.
| double GClasses::GCategoricalDistribution::entropy | ( | ) |
Returns the entropy of the values.
|
inlinevirtual |
Returns true.
Implements GClasses::GUnivariateDistribution.
|
virtual |
Returns true if x is within the range of support. If x is not an integer, it will round x to the nearest integer and then return true if that value is supported.
Implements GClasses::GUnivariateDistribution.
|
inlinevirtual |
See the comment for GUnivariateDistribution::likelihood.
Implements GClasses::GUnivariateDistribution.
|
virtual |
See the comment for GUnivariateDistribution::logLikelihood.
Implements GClasses::GUnivariateDistribution.
|
inlinevirtual |
Returns the mode.
Implements GClasses::GUnivariateDistribution.
| void GClasses::GCategoricalDistribution::normalize | ( | ) |
Makes the values sum to 1, and finds the mode.
|
inline |
Computes the entropy of the values, normalized to fall between 0 and 1.
| void GClasses::GCategoricalDistribution::normalizeFromLogSpace | ( | ) |
Safely converts from log space, and then normalizes.
Save values to a text format.
|
inline |
(1-d) is the probability of 0, and d is the probability of 1
| void GClasses::GCategoricalDistribution::setSpike | ( | size_t | nValueCount, |
| size_t | nValue, | ||
| size_t | nDepth | ||
| ) |
This is a hack for when you know the mode but you don't know the other values.
|
inline |
Set all uniform probabilities.
| void GClasses::GCategoricalDistribution::setValues | ( | size_t | nValueCount, |
| const double * | pValues | ||
| ) |
Sets the specified values, and normalizes.
| void GClasses::GCategoricalDistribution::setValuesInferLast | ( | size_t | nValueCount, |
| const double * | pValues | ||
| ) |
Sets the specified values, except infers the last, and normalizes.
|
inlinevirtual |
Returns categorical.
Implements GClasses::GUnivariateDistribution.
|
inline |
Returns the number of supported values.
|
inline |
Resizes the vector of probabilities if it does not have nValueCount elements, and returns that vector.
|
protected |
|
protected |
|
protected |