SimpleCV splits data into two sets - training and validation sets - and then runs training on the training set and evaluates performance on the validation set. More...
Public Member Functions | |
template < typename MatInType , typename PredictionsInType > | |
| SimpleCV (const double validationSize, MatInType &&xs, PredictionsInType &&ys) | |
| This constructor can be used for regression algorithms and for binary classification algorithms. More... | |
template < typename MatInType , typename PredictionsInType > | |
| SimpleCV (const double validationSize, MatInType &&xs, PredictionsInType &&ys, const size_t numClasses) | |
| This constructor can be used for multiclass classification algorithms. More... | |
template < typename MatInType , typename PredictionsInType > | |
| SimpleCV (const double validationSize, MatInType &&xs, const data::DatasetInfo &datasetInfo, PredictionsInType &&ys, const size_t numClasses) | |
| This constructor can be used for multiclass classification algorithms that can take a data::DatasetInfo parameter. More... | |
template < typename MatInType , typename PredictionsInType , typename WeightsInType > | |
| SimpleCV (const double validationSize, MatInType &&xs, PredictionsInType &&ys, WeightsInType &&weights) | |
| This constructor can be used for regression and binary classification algorithms that support weighted learning. More... | |
template < typename MatInType , typename PredictionsInType , typename WeightsInType > | |
| SimpleCV (const double validationSize, MatInType &&xs, PredictionsInType &&ys, const size_t numClasses, WeightsInType &&weights) | |
| This constructor can be used for multiclass classification algorithms that support weighted learning. More... | |
template < typename MatInType , typename PredictionsInType , typename WeightsInType > | |
| SimpleCV (const double validationSize, MatInType &&xs, const data::DatasetInfo &datasetInfo, PredictionsInType &&ys, const size_t numClasses, WeightsInType &&weights) | |
| This constructor can be used for multiclass classification algorithms that can take a data::DatasetInfo parameter and support weighted learning. More... | |
| template<typename... MLAlgorithmArgs> | |
| double | Evaluate (const MLAlgorithmArgs &... args) |
| Train on the training set and assess performance on the validation set by using the class Metric. More... | |
| MLAlgorithm & | Model () |
| Access and modify the last trained model. More... | |
SimpleCV splits data into two sets - training and validation sets - and then runs training on the training set and evaluates performance on the validation set.
To construct a SimpleCV object you need to pass the validationSize parameter and arguments that specify data. For example, SoftmaxRegression can be validated in the following way.
In the example above, 80% of the passed dataset will be used for training, and remaining 20% will be used for calculating the accuracy metric.
| MLAlgorithm | A machine learning algorithm. |
| Metric | A metric to assess the quality of a trained model. |
| MatType | The type of data. |
| PredictionsType | The type of predictions (should be passed when the predictions type is a template parameter in Train methods of the given MLAlgorithm; arma::Row<size_t> will be used otherwise). |
| WeightsType | The type of weights (should be passed when weighted learning is supported, and the weights type is a template parameter in Train methods of the given MLAlgorithm; arma::vec will be used otherwise). |
Definition at line 68 of file simple_cv.hpp.
| SimpleCV | ( | const double | validationSize, |
| MatInType && | xs, | ||
| PredictionsInType && | ys | ||
| ) |
This constructor can be used for regression algorithms and for binary classification algorithms.
| validationSize | A proportion (between 0 and 1) of data used as a validation set. |
| xs | Data points to cross-validate on. |
| ys | Predictions (labels for classification algorithms and responses for regression algorithms) for each data point. |
| MatInType | A type that can be converted to MatType. |
| PredictionsInType | A type that can be converted to PredictionsType. |
| SimpleCV | ( | const double | validationSize, |
| MatInType && | xs, | ||
| PredictionsInType && | ys, | ||
| const size_t | numClasses | ||
| ) |
This constructor can be used for multiclass classification algorithms.
| validationSize | A proportion (between 0 and 1) of data used as a validation set. |
| xs | Data points to cross-validate on. |
| ys | Labels for each data point. |
| numClasses | Number of classes in the dataset. |
| MatInType | A type that can be converted to MatType. |
| PredictionsInType | A type that can be converted to PredictionsType. |
| SimpleCV | ( | const double | validationSize, |
| MatInType && | xs, | ||
| const data::DatasetInfo & | datasetInfo, | ||
| PredictionsInType && | ys, | ||
| const size_t | numClasses | ||
| ) |
This constructor can be used for multiclass classification algorithms that can take a data::DatasetInfo parameter.
| validationSize | A proportion (between 0 and 1) of data used as a validation set. |
| xs | Data points to cross-validate on. |
| datasetInfo | Type information for each dimension of the dataset. |
| ys | Labels for each data point. |
| numClasses | Number of classes in the dataset. |
| MatInType | A type that can be converted to MatType. |
| PredictionsInType | A type that can be converted to PredictionsType. |
| SimpleCV | ( | const double | validationSize, |
| MatInType && | xs, | ||
| PredictionsInType && | ys, | ||
| WeightsInType && | weights | ||
| ) |
This constructor can be used for regression and binary classification algorithms that support weighted learning.
| validationSize | A proportion (between 0 and 1) of data used as a validation set. |
| xs | Data points to cross-validate on. |
| ys | Predictions (labels for classification algorithms and responses for regression algorithms) for each data point. |
| weights | Observation weights (for boosting). |
| MatInType | A type that can be converted to MatType. |
| PredictionsInType | A type that can be converted to PredictionsType. |
| WeightsInType | A type that can be converted to WeightsType. |
| SimpleCV | ( | const double | validationSize, |
| MatInType && | xs, | ||
| PredictionsInType && | ys, | ||
| const size_t | numClasses, | ||
| WeightsInType && | weights | ||
| ) |
This constructor can be used for multiclass classification algorithms that support weighted learning.
| validationSize | A proportion (between 0 and 1) of data used as a validation set. |
| xs | Data points to cross-validate on. |
| ys | Labels for each data point. |
| numClasses | Number of classes in the dataset. |
| weights | Observation weights (for boosting). |
| MatInType | A type that can be converted to MatType. |
| PredictionsInType | A type that can be converted to PredictionsType. |
| WeightsInType | A type that can be converted to WeightsType. |
| SimpleCV | ( | const double | validationSize, |
| MatInType && | xs, | ||
| const data::DatasetInfo & | datasetInfo, | ||
| PredictionsInType && | ys, | ||
| const size_t | numClasses, | ||
| WeightsInType && | weights | ||
| ) |
This constructor can be used for multiclass classification algorithms that can take a data::DatasetInfo parameter and support weighted learning.
| validationSize | A proportion (between 0 and 1) of data used as a validation set. |
| xs | Data points to cross-validate on. |
| datasetInfo | Type information for each dimension of the dataset. |
| ys | Labels for each data point. |
| numClasses | Number of classes in the dataset. |
| weights | Observation weights (for boosting). |
| MatInType | A type that can be converted to MatType. |
| PredictionsInType | A type that can be converted to PredictionsType. |
| WeightsInType | A type that can be converted to WeightsType. |
| double Evaluate | ( | const MLAlgorithmArgs &... | args | ) |
Train on the training set and assess performance on the validation set by using the class Metric.
| args | Arguments for the given MLAlgorithm taken by its constructor (in addition to the passed ones in the SimpleCV constructor). |
| MLAlgorithm& Model | ( | ) |
Access and modify the last trained model.