Template class for performing cross-validation on the regularization parameter: derived-from-CV_base thorugh CRTP ('CV_alpha' its template D parameter).
More...
|
| template<typename STOR_OBJ, typename STRATEGY> |
| | CV_alpha (STOR_OBJ &&Data, STRATEGY &&strategy, const std::vector< double > ¶ms, int k, const pred_func_t< k_imp > &pred_f, int number_threads) |
| | Constructor if number of PPCs k is known (k_imp=K_IMP::YES), for derived class: constructs firstly CV_base<CV_alpha,...>
|
| |
| template<typename STOR_OBJ, typename STRATEGY> |
| | CV_alpha (STOR_OBJ &&Data, STRATEGY &&strategy, const std::vector< double > ¶ms, double threshold_ppc, const pred_func_t< k_imp > &pred_f, int number_threads) |
| | Constructor if number of PPCs k is not known (k_imp=K_IMP::NO), but has to be retained using explanatory power criterion, for derived class: constructs firstly CV_base<CV_alpha,...>
|
| |
| double | param_best () const |
| | Getter for the best regularization parameter.
|
| |
| std::vector< double > | valid_errors () const |
| | Getter for validation errors.
|
| |
| double | best_valid_error () const |
| | Getter for the best validation error.
|
| |
| double | error_single_cv_iter (const double ¶m, const KO_Traits::StoringMatrix &training_set, const KO_Traits::StoringMatrix &validation_set) const |
| | Error for a single cross-validation iteration (parameter given), with fixed training and validation sets.
|
| |
| double | error_single_param (const double ¶m, const cv_strategy_t &strat, const std::size_t &number_cv_iter) const |
| | Validation error for a given parameter, as the mean of the errors on the various validation sets.
|
| |
| void | best_param_search () |
| | Selecting the best regularization parameter, modifying it into the class.
|
| |
| double | err_valid_set_eval (const KO_Traits::StoringVector &pred, const KO_Traits::StoringVector &valid, int number_threads) const |
| | Evaluation of the loss between prediction on validation set and validation set: estimate of L2 norm loss. Tag-dispacther.
|
| |
| | CV_base (STOR_OBJ &&Data, STRATEGY &&strategy, int number_threads) |
| | Constructor for the class.
|
| |
| KO_Traits::StoringMatrix | Data () const |
| | Getter for the data matrix.
|
| |
| cv_strategy< cv_strat > | strategy () const |
| | Getter for the training/validation set splitting.
|
| |
| int | number_threads () const |
| | Getter for the number of threads for OMP.
|
| |
Template class for performing cross-validation on the regularization parameter: derived-from-CV_base thorugh CRTP ('CV_alpha' its template D parameter).
- Template Parameters
-
| cv_strat | strategy for splitting training/validation sets |
| err_eval | how to evaluate the loss between prediction on validation set and validation set |
| k_imp | if k is imposed or has to be found through explanatory power criterion |
| valid_err_ret | if validation error are stored |
Derived class. Polymorphism is known at compile time thanks to Curiously Recursive Template Pattern (CRTP)
template<typename STOR_OBJ, typename STRATEGY>
| CV_alpha< cv_strat, err_eval, k_imp, valid_err_ret >::CV_alpha |
( |
STOR_OBJ && | Data, |
|
|
STRATEGY && | strategy, |
|
|
const std::vector< double > & | params, |
|
|
double | threshold_ppc, |
|
|
const pred_func_t< k_imp > & | pred_f, |
|
|
int | number_threads ) |
|
inline |
Constructor if number of PPCs k is not known (k_imp=K_IMP::NO), but has to be retained using explanatory power criterion, for derived class: constructs firstly CV_base<CV_alpha,...>
- Parameters
-
| Data | fts data matrix |
| strategy | splitting training/validation strategy |
| params | input space for regularization parameter |
| threshold_ppc | requested explanatory power for PPCs |
| pred_f | function to make validation set prediction (overloading with k not imposed) |
| number_threads | number of threads for OMP |
Universal constructor: move semantic used to optimazing handling big size objects