GClasses
GClasses::GLearnerLib Class Reference

Detailed Description

Provides some useful functions for instantiating learning algorithms from the command line.

#include <GLearnerLib.h>

Static Public Member Functions

static void autoTune (GArgReader &args)
 
static void autoTuneDecisionTree (GMatrix &features, GMatrix &labels)
 
static void autoTuneGraphCutTransducer (GMatrix &features, GMatrix &labels)
 
static void autoTuneKNN (GMatrix &features, GMatrix &labels)
 
static void autoTuneNaiveBayes (GMatrix &features, GMatrix &labels)
 
static void autoTuneNaiveInstance (GMatrix &features, GMatrix &labels)
 
static void autoTuneNeuralNet (GMatrix &features, GMatrix &labels)
 
static void CrossValidate (GArgReader &args)
 
static void CrossValidateCallback (void *pSupLearner, size_t nRep, size_t nFold, double foldSSE, size_t rows)
 
static size_t getAttrVal (const char *szString, size_t attrCount)
 
static GAgglomerativeTransducer * InstantiateAgglomerativeTransducer (GArgReader &args, GMatrix *pFeatures, GMatrix *pLabels)
 
static GTransducer * InstantiateAlgorithm (GArgReader &args, GMatrix *pFeatures, GMatrix *pLabels)
 
static GBag * InstantiateBag (GArgReader &args, GMatrix *pFeatures, GMatrix *pLabels)
 
static GBaselineLearner * InstantiateBaseline (GArgReader &args, GMatrix *pFeatures, GMatrix *pLabels)
 
static GBlock * instantiateBlock (GArgReader &args)
 
static GBayesianModelAveraging * InstantiateBMA (GArgReader &args, GMatrix *pFeatures, GMatrix *pLabels)
 
static GBayesianModelCombination * InstantiateBMC (GArgReader &args, GMatrix *pFeatures, GMatrix *pLabels)
 
static GBomb * InstantiateBomb (GArgReader &args, GMatrix *pFeatures, GMatrix *pLabels)
 
static GResamplingAdaBoost * InstantiateBoost (GArgReader &args, GMatrix *pFeatures, GMatrix *pLabels)
 
static GBucket * InstantiateBucket (GArgReader &args, GMatrix *pFeatures, GMatrix *pLabels)
 
static GBucket * InstantiateCvdt (GArgReader &args)
 
static GDecisionTree * InstantiateDecisionTree (GArgReader &args, GMatrix *pFeatures, GMatrix *pLabels)
 
static GGaussianProcess * InstantiateGaussianProcess (GArgReader &args, GMatrix *pFeatures, GMatrix *pLabels)
 
static GGraphCutTransducer * InstantiateGraphCutTransducer (GArgReader &args, GMatrix *pFeatures, GMatrix *pLabels)
 
static GBayesianModelCombination * InstantiateHodgePodge (GArgReader &args, GMatrix *pFeatures, GMatrix *pLabels)
 
static GKNN * InstantiateKNN (GArgReader &args, GMatrix *pFeatures, GMatrix *pLabels)
 
static GLinearRegressor * InstantiateLinearRegressor (GArgReader &args, GMatrix *pFeatures, GMatrix *pLabels)
 
static GMeanMarginsTree * InstantiateMeanMarginsTree (GArgReader &args, GMatrix *pFeatures, GMatrix *pLabels)
 
static GNaiveBayes * InstantiateNaiveBayes (GArgReader &args, GMatrix *pFeatures, GMatrix *pLabels)
 
static GNaiveInstance * InstantiateNaiveInstance (GArgReader &args, GMatrix *pFeatures, GMatrix *pLabels)
 
static GNeighborTransducer * InstantiateNeighborTransducer (GArgReader &args, GMatrix *pFeatures, GMatrix *pLabels)
 
static GNeuralNetLearner * InstantiateNeuralNet (GArgReader &args, GMatrix *pFeatures, GMatrix *pLabels)
 
static GRandomForest * InstantiateRandomForest (GArgReader &args)
 
static GReservoirNet * InstantiateReservoirNet (GArgReader &args, GMatrix *pFeatures, GMatrix *pLabels)
 
static GWag * InstantiateWag (GArgReader &args, GMatrix *pFeatures, GMatrix *pLabels)
 
static void leftJustifiedString (const char *pIn, char *pOut, size_t outLen)
 
static void loadData (GArgReader &args, std::unique_ptr< GMatrix > &hFeaturesOut, std::unique_ptr< GMatrix > &hLabelsOut, bool requireMetadata=false)
 
static std::string machineReadableConfusionData (std::size_t variable_idx, const GRelation *pRelation, GMatrix const *const pMatrix)
 for variable variable_idx as printed by printMachineReadableConfusionMatrices More...
 
static std::string machineReadableConfusionHeader (std::size_t variable_idx, const GRelation *pRelation)
 Returns the header for the machine readable confusion matrix for variable variable_idx as printed by printMachineReadableConfusionMatrices. More...
 
static void metaData (GArgReader &args)
 
static void parseAttributeList (vector< size_t > &list, GArgReader &args, size_t attrCount)
 
static void PrecisionRecall (GArgReader &args)
 
static void predict (GArgReader &args)
 
static void predictDistribution (GArgReader &args)
 
static void printConfusionMatrices (const GRelation *pRelation, vector< GMatrix * > &matrixArray)
 
static void printMachineReadableConfusionMatrices (const GRelation *pRelation, vector< GMatrix * > &matrixArray)
 Prints the confusion matrices as machine-readable csv-like lines. More...
 
static void regress (GArgReader &args)
 
static void rightJustifiedString (const char *pIn, char *pOut, size_t outLen)
 
static void showError (GArgReader &args, const char *szAppName, const char *szMessage)
 
static void showInstantiateAlgorithmError (const char *szMessage, GArgReader &args)
 
static void ShowUsage (const char *appName)
 
static void SplitTest (GArgReader &args)
 
static void sterilize (GArgReader &args)
 
static void Test (GArgReader &args)
 
static void Train (GArgReader &args)
 
static void Transduce (GArgReader &args)
 
static void TransductiveAccuracy (GArgReader &args)
 
static void vette (string &s)
 

Member Function Documentation

static void GClasses::GLearnerLib::autoTune ( GArgReader &  args)
static
static void GClasses::GLearnerLib::autoTuneDecisionTree ( GMatrix &  features,
GMatrix &  labels 
)
static
static void GClasses::GLearnerLib::autoTuneGraphCutTransducer ( GMatrix &  features,
GMatrix &  labels 
)
static
static void GClasses::GLearnerLib::autoTuneKNN ( GMatrix &  features,
GMatrix &  labels 
)
static
static void GClasses::GLearnerLib::autoTuneNaiveBayes ( GMatrix &  features,
GMatrix &  labels 
)
static
static void GClasses::GLearnerLib::autoTuneNaiveInstance ( GMatrix &  features,
GMatrix &  labels 
)
static
static void GClasses::GLearnerLib::autoTuneNeuralNet ( GMatrix &  features,
GMatrix &  labels 
)
static
static void GClasses::GLearnerLib::CrossValidate ( GArgReader &  args)
static
static void GClasses::GLearnerLib::CrossValidateCallback ( void *  pSupLearner,
size_t  nRep,
size_t  nFold,
double  foldSSE,
size_t  rows 
)
static
static size_t GClasses::GLearnerLib::getAttrVal ( const char *  szString,
size_t  attrCount 
)
static
static GAgglomerativeTransducer* GClasses::GLearnerLib::InstantiateAgglomerativeTransducer ( GArgReader &  args,
GMatrix *  pFeatures,
GMatrix *  pLabels 
)
static
static GTransducer* GClasses::GLearnerLib::InstantiateAlgorithm ( GArgReader &  args,
GMatrix *  pFeatures,
GMatrix *  pLabels 
)
static
static GBag* GClasses::GLearnerLib::InstantiateBag ( GArgReader &  args,
GMatrix *  pFeatures,
GMatrix *  pLabels 
)
static
static GBaselineLearner* GClasses::GLearnerLib::InstantiateBaseline ( GArgReader &  args,
GMatrix *  pFeatures,
GMatrix *  pLabels 
)
static
static GBlock* GClasses::GLearnerLib::instantiateBlock ( GArgReader &  args)
static
static GBayesianModelAveraging* GClasses::GLearnerLib::InstantiateBMA ( GArgReader &  args,
GMatrix *  pFeatures,
GMatrix *  pLabels 
)
static
static GBayesianModelCombination* GClasses::GLearnerLib::InstantiateBMC ( GArgReader &  args,
GMatrix *  pFeatures,
GMatrix *  pLabels 
)
static
static GBomb* GClasses::GLearnerLib::InstantiateBomb ( GArgReader &  args,
GMatrix *  pFeatures,
GMatrix *  pLabels 
)
static
static GResamplingAdaBoost* GClasses::GLearnerLib::InstantiateBoost ( GArgReader &  args,
GMatrix *  pFeatures,
GMatrix *  pLabels 
)
static
static GBucket* GClasses::GLearnerLib::InstantiateBucket ( GArgReader &  args,
GMatrix *  pFeatures,
GMatrix *  pLabels 
)
static
static GBucket* GClasses::GLearnerLib::InstantiateCvdt ( GArgReader &  args)
static
static GDecisionTree* GClasses::GLearnerLib::InstantiateDecisionTree ( GArgReader &  args,
GMatrix *  pFeatures,
GMatrix *  pLabels 
)
static
static GGaussianProcess* GClasses::GLearnerLib::InstantiateGaussianProcess ( GArgReader &  args,
GMatrix *  pFeatures,
GMatrix *  pLabels 
)
static
static GGraphCutTransducer* GClasses::GLearnerLib::InstantiateGraphCutTransducer ( GArgReader &  args,
GMatrix *  pFeatures,
GMatrix *  pLabels 
)
static
static GBayesianModelCombination* GClasses::GLearnerLib::InstantiateHodgePodge ( GArgReader &  args,
GMatrix *  pFeatures,
GMatrix *  pLabels 
)
static
static GKNN* GClasses::GLearnerLib::InstantiateKNN ( GArgReader &  args,
GMatrix *  pFeatures,
GMatrix *  pLabels 
)
static
static GLinearRegressor* GClasses::GLearnerLib::InstantiateLinearRegressor ( GArgReader &  args,
GMatrix *  pFeatures,
GMatrix *  pLabels 
)
static
static GMeanMarginsTree* GClasses::GLearnerLib::InstantiateMeanMarginsTree ( GArgReader &  args,
GMatrix *  pFeatures,
GMatrix *  pLabels 
)
static
static GNaiveBayes* GClasses::GLearnerLib::InstantiateNaiveBayes ( GArgReader &  args,
GMatrix *  pFeatures,
GMatrix *  pLabels 
)
static
static GNaiveInstance* GClasses::GLearnerLib::InstantiateNaiveInstance ( GArgReader &  args,
GMatrix *  pFeatures,
GMatrix *  pLabels 
)
static
static GNeighborTransducer* GClasses::GLearnerLib::InstantiateNeighborTransducer ( GArgReader &  args,
GMatrix *  pFeatures,
GMatrix *  pLabels 
)
static
static GNeuralNetLearner* GClasses::GLearnerLib::InstantiateNeuralNet ( GArgReader &  args,
GMatrix *  pFeatures,
GMatrix *  pLabels 
)
static
static GRandomForest* GClasses::GLearnerLib::InstantiateRandomForest ( GArgReader &  args)
static
static GReservoirNet* GClasses::GLearnerLib::InstantiateReservoirNet ( GArgReader &  args,
GMatrix *  pFeatures,
GMatrix *  pLabels 
)
static
static GWag* GClasses::GLearnerLib::InstantiateWag ( GArgReader &  args,
GMatrix *  pFeatures,
GMatrix *  pLabels 
)
static
static void GClasses::GLearnerLib::leftJustifiedString ( const char *  pIn,
char *  pOut,
size_t  outLen 
)
static
static void GClasses::GLearnerLib::loadData ( GArgReader &  args,
std::unique_ptr< GMatrix > &  hFeaturesOut,
std::unique_ptr< GMatrix > &  hLabelsOut,
bool  requireMetadata = false 
)
static
static std::string GClasses::GLearnerLib::machineReadableConfusionData ( std::size_t  variable_idx,
const GRelation *  pRelation,
GMatrix const *const  pMatrix 
)
static

for variable variable_idx as printed by printMachineReadableConfusionMatrices

The first entry is the name of the variable. The second entry is the value of variable_idx, The entry (r*numCols+c)+2 where r and c are both in 0..nv-1, nv being the number of values that the variable takes on, is the entry at row r and column c of *pMatrix

Parameters
variable_idxthe index of the variable in the relation
pRelationa pointer to the relation from which the variable_idx-'th variable is taken. Cannot be NULL.
pMatrixa pointer to the confusion matrix. (*pMatrix)[r][c] is the number of times that r was expected and c was received. Cannot be NULL.
static std::string GClasses::GLearnerLib::machineReadableConfusionHeader ( std::size_t  variable_idx,
const GRelation *  pRelation 
)
static

Returns the header for the machine readable confusion matrix for variable variable_idx as printed by printMachineReadableConfusionMatrices.

The header is comma-separated values. The first two entries in the header are "Variable Name","Variable Index". The rest of the entries fit the format "Expected:xxx/Got:yyy" where xxx and yyy are two values that the variable can take on.

Parameters
variable_idxthe index of the variable in the relation
pRelationa pointer to the relation from which the variable_idx-'th variable is taken. Cannot be null
static void GClasses::GLearnerLib::metaData ( GArgReader &  args)
static
static void GClasses::GLearnerLib::parseAttributeList ( vector< size_t > &  list,
GArgReader &  args,
size_t  attrCount 
)
static
static void GClasses::GLearnerLib::PrecisionRecall ( GArgReader &  args)
static
static void GClasses::GLearnerLib::predict ( GArgReader &  args)
static
static void GClasses::GLearnerLib::predictDistribution ( GArgReader &  args)
static
static void GClasses::GLearnerLib::printConfusionMatrices ( const GRelation *  pRelation,
vector< GMatrix * > &  matrixArray 
)
static
static void GClasses::GLearnerLib::printMachineReadableConfusionMatrices ( const GRelation *  pRelation,
vector< GMatrix * > &  matrixArray 
)
static

Prints the confusion matrices as machine-readable csv-like lines.

The first line is a header giving the names of the columns for the next line. The first column is the name of the label variable for which the matrix is being printed. The rest of the columns are the names of the expected/got values (row/column in the input matrices)

Parameters
pRelationthe relation for which the confusion matrices are given. Cannot be NULL.
matrixArraymatrixArray[i] is null if there is no matrix to be printed. Otherwise matrixArray[i] is the confusion matrix for the i'th attribute of pRelation. Row r, column c of matrixArray[i] is the number of times the value r of the attribute was expected and c was encountered.
static void GClasses::GLearnerLib::regress ( GArgReader &  args)
static
static void GClasses::GLearnerLib::rightJustifiedString ( const char *  pIn,
char *  pOut,
size_t  outLen 
)
static
static void GClasses::GLearnerLib::showError ( GArgReader &  args,
const char *  szAppName,
const char *  szMessage 
)
static
static void GClasses::GLearnerLib::showInstantiateAlgorithmError ( const char *  szMessage,
GArgReader &  args 
)
static
static void GClasses::GLearnerLib::ShowUsage ( const char *  appName)
static
static void GClasses::GLearnerLib::SplitTest ( GArgReader &  args)
static
static void GClasses::GLearnerLib::sterilize ( GArgReader &  args)
static
static void GClasses::GLearnerLib::Test ( GArgReader &  args)
static
static void GClasses::GLearnerLib::Train ( GArgReader &  args)
static
static void GClasses::GLearnerLib::Transduce ( GArgReader &  args)
static
static void GClasses::GLearnerLib::TransductiveAccuracy ( GArgReader &  args)
static
static void GClasses::GLearnerLib::vette ( string &  s)
static