PPCKO: Principal Predictive Components for Estimating an Autoregressive Operator
 
Loading...
Searching...
No Matches
CV_alpha_k< cv_strat, err_eval, k_imp, valid_err_ret > Class Template Reference

Template class for performing cross-validation on the regularization parameter and the number of PPCs: derived-from-CV_base thorugh CRTP ('CV_alpha_k' its template D parameter). More...

#include <CV_alpha_k.hpp>

Inheritance diagram for CV_alpha_k< cv_strat, err_eval, k_imp, valid_err_ret >:
CV_base< CV_alpha_k< cv_strat, err_eval, k_imp, valid_err_ret >, cv_strat, err_eval, k_imp, valid_err_ret >

Public Member Functions

template<typename STOR_OBJ, typename STRATEGY>
 CV_alpha_k (STOR_OBJ &&Data, STRATEGY &&strategy, const std::vector< double > &alphas, const std::vector< int > &k_s, double toll, const pred_func_t< K_IMP::YES > &pred_f, int number_threads)
 Constructor for derived class: constructs firstly CV_base<CV_alpha_k,...>
 
double alpha_best () const
 Getter for the best regularization parameter.
 
double k_best () const
 Getter for the best number of retained PPCs.
 
std::vector< double > valid_errors_best_pairs () const
 Getter for validation errors for the best pairs.
 
std::vector< std::vector< double > > valid_errors () const
 Getter for validation errors.
 
double best_valid_error () const
 Getter for the best validation error.
 
void best_param_search ()
 Retaining the best pair regularization parameter-number of retained PPCs.
 
- Public Member Functions inherited from CV_base< CV_alpha_k< cv_strat, err_eval, k_imp, valid_err_ret >, cv_strat, err_eval, k_imp, valid_err_ret >
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.
 

Detailed Description

template<CV_STRAT cv_strat, CV_ERR_EVAL err_eval, K_IMP k_imp, VALID_ERR_RET valid_err_ret>
class CV_alpha_k< cv_strat, err_eval, k_imp, valid_err_ret >

Template class for performing cross-validation on the regularization parameter and the number of PPCs: derived-from-CV_base thorugh CRTP ('CV_alpha_k' its template D parameter).

Template Parameters
cv_stratstrategy for splitting training/validation sets
err_evalhow to evaluate the loss between prediction on validation set and validation set
k_impif k is imposed or has to be found through explanatory power criterion (necessary k_imp=K_IMP::YES since k is imposed at each cv iteration)
valid_err_retif validation error are stored

Derived class. Polymorphism is known at compile time thanks to Curiously Recursive Template Pattern (CRTP)

Constructor & Destructor Documentation

◆ CV_alpha_k()

template<CV_STRAT cv_strat, CV_ERR_EVAL err_eval, K_IMP k_imp, VALID_ERR_RET valid_err_ret>
template<typename STOR_OBJ, typename STRATEGY>
CV_alpha_k< cv_strat, err_eval, k_imp, valid_err_ret >::CV_alpha_k ( STOR_OBJ && Data,
STRATEGY && strategy,
const std::vector< double > & alphas,
const std::vector< int > & k_s,
double toll,
const pred_func_t< K_IMP::YES > & pred_f,
int number_threads )
inline

Constructor for derived class: constructs firstly CV_base<CV_alpha_k,...>

Parameters
Datafts data matrix
strategysplitting training/validation strategy
alphasinput space for the regularization parameter
k_sinput space for number of retained PPCs
tolltolerance between consecutive validation errors for looking for element with bigger value in the input space
pred_ffunction to make validation set prediction (overloading with k imposed)
number_threadsnumber of threads for OMP

Universal constructor: move semantic used to optimazing handling big size objects

Member Function Documentation

◆ alpha_best()

template<CV_STRAT cv_strat, CV_ERR_EVAL err_eval, K_IMP k_imp, VALID_ERR_RET valid_err_ret>
double CV_alpha_k< cv_strat, err_eval, k_imp, valid_err_ret >::alpha_best ( ) const
inline

Getter for the best regularization parameter.

Returns
the private m_alpha_best

◆ best_param_search()

template<CV_STRAT cv_strat, CV_ERR_EVAL err_eval, K_IMP k_imp, VALID_ERR_RET valid_err_ret>
void CV_alpha_k< cv_strat, err_eval, k_imp, valid_err_ret >::best_param_search ( )
inline

Retaining the best pair regularization parameter-number of retained PPCs.

for each element of the input space for regularization parameters, a cross-validation on the number of retained PPCs is performed. Consequently, the best pair is looked for within this ones.

Note
eventual usage of 'pragma' directive for OMP

◆ best_valid_error()

template<CV_STRAT cv_strat, CV_ERR_EVAL err_eval, K_IMP k_imp, VALID_ERR_RET valid_err_ret>
double CV_alpha_k< cv_strat, err_eval, k_imp, valid_err_ret >::best_valid_error ( ) const
inline

Getter for the best validation error.

Returns
the private m_best_valid_error

◆ k_best()

template<CV_STRAT cv_strat, CV_ERR_EVAL err_eval, K_IMP k_imp, VALID_ERR_RET valid_err_ret>
double CV_alpha_k< cv_strat, err_eval, k_imp, valid_err_ret >::k_best ( ) const
inline

Getter for the best number of retained PPCs.

Returns
the private m_k_best

◆ valid_errors()

template<CV_STRAT cv_strat, CV_ERR_EVAL err_eval, K_IMP k_imp, VALID_ERR_RET valid_err_ret>
std::vector< std::vector< double > > CV_alpha_k< cv_strat, err_eval, k_imp, valid_err_ret >::valid_errors ( ) const
inline

Getter for validation errors.

Returns
the private m_valid_errors

◆ valid_errors_best_pairs()

template<CV_STRAT cv_strat, CV_ERR_EVAL err_eval, K_IMP k_imp, VALID_ERR_RET valid_err_ret>
std::vector< double > CV_alpha_k< cv_strat, err_eval, k_imp, valid_err_ret >::valid_errors_best_pairs ( ) const
inline

Getter for validation errors for the best pairs.

Returns
the private m_valid_errors_best_pairs

The documentation for this class was generated from the following file: