GeneralCrossValidator< TLearner > Class Template Reference

ALPHA VERSION, STILL UNDER CONSTRUCTION. More...

Collaboration diagram for GeneralCrossValidator< TLearner >:
[legend]

List of all members.

Public Types

typedef TLearner Learner
 Typedef of internal learners used.
typedef TLearner Learner
 Typedef of internal learners used.

Public Member Functions

const Matrix & clsf_confusion_matrix () const
 Gets the confusion matrix.
const Matrix & clsf_confusion_matrix () const
 Gets the confusion matrix.
index_t clsf_n_correct ()
 Functions for type 0: classification ONLY.
index_t clsf_n_correct ()
 Functions for type 0: classification ONLY.
index_t clsf_n_incorrect ()
 Gets the number incorrect over all folds.
index_t clsf_n_incorrect ()
 Gets the number incorrect over all folds.
double clsf_portion_correct ()
 Gets the portion calculated correct.
double clsf_portion_correct ()
 Gets the portion calculated correct.
const Datasetdata () const
 Gets the dataset.
const Datasetdata () const
 Gets the dataset.
void Init (int learner_typeid, int default_k, const Dataset *data_input, struct datanode *module_root, const char *learner_fx_name, const char *kfold_fx_name="kfold")
 Uses FastExec to initialize this.
void Init (int learner_typeid, int default_k, const Dataset *data_input, struct datanode *module_root, const char *learner_fx_name, const char *kfold_fx_name="kfold")
 Uses FastExec to initialize this.
void Run (bool randomized)
 Runs cross-validation.
void Run (bool randomized)
 Runs cross-validation.

Detailed Description

template<class TLearner>
class GeneralCrossValidator< TLearner >

ALPHA VERSION, STILL UNDER CONSTRUCTION.

k-fold Cross-validator for general learners (can support Classification, Regression, Density Estimation and other learners)

For classification, the Stratified Cross-Validation is used to ensure that approximately same portion of data (training/validation) are used for each class.

For regression, density estimation and other learners, training and validation data are then drawn from the partitions of input dataset (may be firstly randomized if necessary).

Definition at line 361 of file crossvalidation.h.


Member Typedef Documentation

template<class TLearner>
typedef TLearner GeneralCrossValidator< TLearner >::Learner

Typedef of internal learners used.

Definition at line 366 of file crossvalidation.h.

template<class TLearner>
typedef TLearner GeneralCrossValidator< TLearner >::Learner

Typedef of internal learners used.

Definition at line 366 of file crossvalidation.h.


Member Function Documentation

template<class TLearner>
const Matrix& GeneralCrossValidator< TLearner >::clsf_confusion_matrix (  )  const [inline]

Gets the confusion matrix.

The element at row i column j is the number of training samples where the actual classification is i but the predicted classification is j.

Definition at line 464 of file crossvalidation.h.

template<class TLearner>
const Matrix& GeneralCrossValidator< TLearner >::clsf_confusion_matrix (  )  const [inline]

Gets the confusion matrix.

The element at row i column j is the number of training samples where the actual classification is i but the predicted classification is j.

Definition at line 464 of file crossvalidation.h.

template<class TLearner>
index_t GeneralCrossValidator< TLearner >::clsf_n_correct (  )  [inline]

Functions for type 0: classification ONLY.

Gets the number correctly classified over all folds.

Definition at line 447 of file crossvalidation.h.

template<class TLearner>
index_t GeneralCrossValidator< TLearner >::clsf_n_correct (  )  [inline]

Functions for type 0: classification ONLY.

Gets the number correctly classified over all folds.

Definition at line 447 of file crossvalidation.h.

Referenced by GeneralCrossValidator< TLearner >::Run().

template<class TLearner>
index_t GeneralCrossValidator< TLearner >::clsf_n_incorrect (  )  [inline]

Gets the number incorrect over all folds.

Definition at line 451 of file crossvalidation.h.

References Dataset::n_points().

template<class TLearner>
index_t GeneralCrossValidator< TLearner >::clsf_n_incorrect (  )  [inline]

Gets the number incorrect over all folds.

Definition at line 451 of file crossvalidation.h.

References Dataset::n_points().

Referenced by GeneralCrossValidator< TLearner >::Run().

template<class TLearner>
double GeneralCrossValidator< TLearner >::clsf_portion_correct (  )  [inline]

Gets the portion calculated correct.

Definition at line 455 of file crossvalidation.h.

References Dataset::n_points().

template<class TLearner>
double GeneralCrossValidator< TLearner >::clsf_portion_correct (  )  [inline]

Gets the portion calculated correct.

Definition at line 455 of file crossvalidation.h.

References Dataset::n_points().

Referenced by GeneralCrossValidator< TLearner >::Run().

template<class TLearner>
const Dataset& GeneralCrossValidator< TLearner >::data (  )  const [inline]

Gets the dataset.

Definition at line 433 of file crossvalidation.h.

template<class TLearner>
const Dataset& GeneralCrossValidator< TLearner >::data (  )  const [inline]

Gets the dataset.

Definition at line 433 of file crossvalidation.h.

template<class TLearner>
void GeneralCrossValidator< TLearner >::Init ( int  learner_typeid,
int  default_k,
const Dataset data_input,
struct datanode module_root,
const char *  learner_fx_name,
const char *  kfold_fx_name = "kfold" 
)

Uses FastExec to initialize this.

See details about this class for more information.

Parameters:
learner_typeid type id of the learner; 0:classification 1:regression 2:density estimation; 3:others
default_k the default number of folds (overridden by command-line parameter kfold/k)
data_input the input dataset (with labels in the last feature for classification case)
module_root the fastexec module this is under (usually use fx_root)
learner_fx_name short name to give it under fastexec
kfold_fx_name the fastexec name of the cross-validator
template<class TLearner >
void GeneralCrossValidator< TLearner >::Init ( int  learner_typeid,
int  default_k,
const Dataset data_input,
struct datanode module_root,
const char *  learner_fx_name,
const char *  kfold_fx_name = "kfold" 
) [inline]

Uses FastExec to initialize this.

See details about this class for more information.

Parameters:
learner_typeid type id of the learner; 0:classification 1:regression 2:density estimation; 3:others
default_k the default number of folds (overridden by command-line parameter kfold/k)
data_input the input dataset (with labels in the last feature for classification case)
module_root the fastexec module this is under (usually use fx_root)
learner_fx_name short name to give it under fastexec
kfold_fx_name the fastexec name of the cross-validator

initialization for general parameters

initialization for type 0: classification ONLY

Definition at line 540 of file crossvalidation.h.

References fx_param_int(), fx_submodule(), and Dataset::n_labels().

Referenced by main().

template<class TLearner>
void GeneralCrossValidator< TLearner >::Run ( bool  randomized  ) 

Runs cross-validation.

Parameters:
randomized whether to use a random permutation of the data, or just to stride it
template<class TLearner >
void GeneralCrossValidator< TLearner >::Run ( bool  randomized  )  [inline]

The documentation for this class was generated from the following files:
Generated on Mon Jan 24 12:04:40 2011 for FASTlib by  doxygen 1.6.3