GClasses
|
This class is used to represent the predicted distribution made by a supervised learning algorithm. (It is just a shallow wrapper around GDistribution.) It is used in conjunction with calls to GSupervisedLearner::predictDistribution. The predicted distributions will be either categorical distributions (for nominal values) or Normal distributions (for continuous values).
#include <GLearner.h>
Public Member Functions | |
GPrediction () | |
~GPrediction () | |
GCategoricalDistribution * | asCategorical () |
Returns the current distribution. Throws if it is not a categorical distribution. More... | |
GNormalDistribution * | asNormal () |
Returns the current distribution. Throws if it is not a normal distribution. More... | |
bool | isContinuous () |
Returns true if this wraps a normal distribution, false otherwise. More... | |
GCategoricalDistribution * | makeCategorical () |
If the current distribution is not a categorical distribution, then it replaces it with a new categorical distribution. Then it returns the current (categorical) distribution. More... | |
GNormalDistribution * | makeNormal () |
If the current distribution is not a normal distribution, then it replaces it with a new normal distribution. Then it returns the current (normal) distribution. More... | |
double | mode () |
Returns the mode (most likely value). For the Normal distribution, this is the same as the mean. More... | |
Static Public Member Functions | |
static void | predictionArrayToVector (size_t nOutputCount, GPrediction *pOutputs, GVec &vec) |
Converts an array of prediction objects to a vector of most-likely values. More... | |
static void | vectorToPredictionArray (GRelation *pRelation, size_t nOutputCount, GVec &vec, GPrediction *pOutputs) |
Converts an array of values to an array of predictions. There's not really enough information for this conversion, so it simply fabricates the variance and class-probability information as needed. Only the mean (for normal distributions) and the most-likely class (for categorical distributions) is reliable after this conversion. More... | |
Protected Attributes | |
GUnivariateDistribution * | m_pDistribution |
|
inline |
GClasses::GPrediction::~GPrediction | ( | ) |
GCategoricalDistribution* GClasses::GPrediction::asCategorical | ( | ) |
Returns the current distribution. Throws if it is not a categorical distribution.
GNormalDistribution* GClasses::GPrediction::asNormal | ( | ) |
Returns the current distribution. Throws if it is not a normal distribution.
bool GClasses::GPrediction::isContinuous | ( | ) |
Returns true if this wraps a normal distribution, false otherwise.
GCategoricalDistribution* GClasses::GPrediction::makeCategorical | ( | ) |
If the current distribution is not a categorical distribution, then it replaces it with a new categorical distribution. Then it returns the current (categorical) distribution.
GNormalDistribution* GClasses::GPrediction::makeNormal | ( | ) |
If the current distribution is not a normal distribution, then it replaces it with a new normal distribution. Then it returns the current (normal) distribution.
double GClasses::GPrediction::mode | ( | ) |
Returns the mode (most likely value). For the Normal distribution, this is the same as the mean.
|
static |
Converts an array of prediction objects to a vector of most-likely values.
|
static |
Converts an array of values to an array of predictions. There's not really enough information for this conversion, so it simply fabricates the variance and class-probability information as needed. Only the mean (for normal distributions) and the most-likely class (for categorical distributions) is reliable after this conversion.
|
protected |