GClasses

GClasses::GPrediction Class Reference

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). More...

#include <GLearner.h>

List of all members.

Public Member Functions

 GPrediction ()
 ~GPrediction ()
bool isContinuous ()
 Returns true if this wraps a normal distribution, false otherwise.
double mode ()
 Returns the mode (most likely value). For the Normal distribution, this is the same as the mean.
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.
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.
GCategoricalDistributionasCategorical ()
 Returns the current distribution. Throws if it is not a categorical distribution.
GNormalDistributionasNormal ()
 Returns the current distribution. Throws if it is not a normal distribution.

Static Public Member Functions

static void predictionArrayToVector (size_t nOutputCount, GPrediction *pOutputs, double *pVector)
 Converts an array of prediction objects to a vector of most-likely values.
static void vectorToPredictionArray (GRelation *pRelation, size_t nOutputCount, double *pVector, 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.

Protected Attributes

GUnivariateDistributionm_pDistribution

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).


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,
double *  pVector 
) [static]

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

static void GClasses::GPrediction::vectorToPredictionArray ( GRelation pRelation,
size_t  nOutputCount,
double *  pVector,
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