GClasses
GClasses::GPrediction Class Reference

Detailed Description

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 ()
 
GCategoricalDistributionasCategorical ()
 Returns the current distribution. Throws if it is not a categorical distribution. More...
 
GNormalDistributionasNormal ()
 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...
 
GCategoricalDistributionmakeCategorical ()
 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...
 
GNormalDistributionmakeNormal ()
 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

GUnivariateDistributionm_pDistribution
 

Constructor & Destructor Documentation

GClasses::GPrediction::GPrediction ( )
inline
GClasses::GPrediction::~GPrediction ( )

Member Function Documentation

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 void GClasses::GPrediction::predictionArrayToVector ( size_t  nOutputCount,
GPrediction pOutputs,
GVec vec 
)
static

Converts an array of prediction objects to a vector of most-likely values.

static void GClasses::GPrediction::vectorToPredictionArray ( GRelation pRelation,
size_t  nOutputCount,
GVec vec,
GPrediction pOutputs 
)
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.

Member Data Documentation

GUnivariateDistribution* GClasses::GPrediction::m_pDistribution
protected