|
STK++ 0.9.13
|
CvHanler is an utility function for building the submatrix/subvectors needed when using k-folds cross-validation. More...
#include <STK_CvHandler.h>

Public Member Functions | |
| CvHandler (Range const &rangeData, int nbFolds) | |
| Default constructor. | |
| virtual | ~CvHandler () |
| destructor | |
| int | nbFolds () const |
| Range const & | rangeData () const |
| CVectorXi const & | partitions () const |
| CVectorXi const & | sizePartitions () const |
| virtual bool | run () |
| run the computations. | |
| void | setData (Range const &rangeData, int nbFolds) |
| template<class Data > | |
| bool | getKFold (int k, Data const &x, Data &xFold, Data &xTest) |
| get the data set when setting out fold k and test data set | |
| template<class xData , class yData > | |
| bool | getKFold (int k, xData const &x, xData &xFold, xData &xTest, yData const &y, yData &yFold, yData &yTest) |
| get the data set when setting out fold k and test data set | |
Public Member Functions inherited from STK::IRunnerBase | |
| String const & | error () const |
| get the last error message. | |
Protected Member Functions | |
| void | partition () |
| create a random partition in k folds | |
Protected Member Functions inherited from STK::IRunnerBase | |
| IRunnerBase () | |
| default constructor | |
| IRunnerBase (IRunnerBase const &runner) | |
| copy constructor | |
| virtual | ~IRunnerBase () |
| destructor | |
| virtual void | update () |
| update the runner. | |
Private Attributes | |
| Range | rangeData_ |
| Range of the data set (number of rows) | |
| int | nbFolds_ |
| Number of folds. | |
| CVectorXi | partitions_ |
| repartition of the sample into k-folds | |
| CVectorXi | sizePartitions_ |
| size of each fold | |
Additional Inherited Members | |
Protected Attributes inherited from STK::IRunnerBase | |
| String | msg_error_ |
| String with the last error message. | |
| bool | hasRun_ |
true if run has been used, false otherwise | |
CvHanler is an utility function for building the submatrix/subvectors needed when using k-folds cross-validation.
Definition at line 52 of file STK_CvHandler.h.
Default constructor.
| rangeData,nbFolds | range of the data and number of folds |
Definition at line 109 of file STK_CvHandler.h.
References CvHandler(), nbFolds(), nbFolds_, rangeData_, STK::TRange< UnknownSize >::size(), and STKRUNTIME_ERROR_1ARG.
Referenced by CvHandler().
|
inlinevirtual |
| bool STK::CvHandler::getKFold | ( | int | k, |
| Data const & | x, | ||
| Data & | xFold, | ||
| Data & | xTest | ||
| ) |
get the data set when setting out fold k and test data set
Definition at line 122 of file STK_CvHandler.h.
References getKFold(), STK::IRunnerBase::hasRun_, STK::IRunnerBase::msg_error_, partitions_, rangeData_, run(), sizePartitions_, STKERROR_1ARG, and STKERROR_NO_ARG.
Referenced by getKFold(), and getKFold().
| bool STK::CvHandler::getKFold | ( | int | k, |
| xData const & | x, | ||
| xData & | xFold, | ||
| xData & | xTest, | ||
| yData const & | y, | ||
| yData & | yFold, | ||
| yData & | yTest | ||
| ) |
get the data set when setting out fold k and test data set
Definition at line 166 of file STK_CvHandler.h.
References getKFold(), STK::IRunnerBase::hasRun_, STK::IRunnerBase::msg_error_, partitions_, rangeData_, run(), sizePartitions_, STKERROR_1ARG, and STKERROR_NO_ARG.
|
inline |
Definition at line 63 of file STK_CvHandler.h.
References nbFolds_.
Referenced by CvHandler(), and setData().
|
inlineprotected |
create a random partition in k folds
Definition at line 219 of file STK_CvHandler.h.
References nbFolds_, partitions_, STK::Law::UniformDiscrete::rand(), rangeData_, STK::ICArray< Derived >::resize(), and sizePartitions_.
Referenced by run().
Definition at line 65 of file STK_CvHandler.h.
References rangeData_.
Referenced by setData().
run the computations.
true if no error occur during the running process, false otherwise Implements STK::IRunnerBase.
Definition at line 71 of file STK_CvHandler.h.
References STK::IRunnerBase::hasRun_, and partition().
Referenced by getKFold(), and getKFold().
Definition at line 74 of file STK_CvHandler.h.
References STK::ICArray< Derived >::clear(), STK::IRunnerBase::hasRun_, nbFolds(), nbFolds_, partitions_, rangeData(), rangeData_, and sizePartitions_.
Definition at line 69 of file STK_CvHandler.h.
References sizePartitions_.
|
private |
Number of folds.
Definition at line 98 of file STK_CvHandler.h.
Referenced by CvHandler(), nbFolds(), partition(), and setData().
|
private |
repartition of the sample into k-folds
Definition at line 100 of file STK_CvHandler.h.
Referenced by getKFold(), getKFold(), partition(), partitions(), and setData().
|
private |
Range of the data set (number of rows)
Definition at line 96 of file STK_CvHandler.h.
Referenced by CvHandler(), getKFold(), getKFold(), partition(), rangeData(), and setData().
|
private |
size of each fold
Definition at line 102 of file STK_CvHandler.h.
Referenced by getKFold(), getKFold(), partition(), setData(), and sizePartitions().