DSL_validator

<< Click to Display Table of Contents >>

Navigation:  Reference Manual >

DSL_validator

Header file: validator.h


DSL_validator(

    DSL_dataset& ds, const DSL_network &net,

    const std::vector<DSL_datasetMatch> &matching,

    const std::vector<int> *fixedNodes = 0);

The constructor requires a reference to a data set, a network and a vector of DSL_datasetMatch objects. If KFold or LeaveOneOut are going to be used, it is also possible to specify which nodes in the network do not change their parameters by passing their handles in the fixedNodes argument.


int AddClassNode(int classNodeHandle);

Adds class node to the internal list of class nodes. Returns DSL_OKAY on success or an error code on failure.


int Test(DSL_progress *progress = 0);

Performs testing using the data set specified in the constructor. The network does not change its parameters during the procedure. Returns DSL_OKAY on success or an error code on failure.

The optional argument progress can be used to stop the testing by returning false from DSL_progress::Tick method, which is called periodically within the main loop of the learning algorithm. In such case, the method returns DSL_INTERRUPTED.


int KFold(DSL_em &em, int foldCount, int randSeed = 0,

    DSL_progress *progress = 0);

Performs K-fold cross-validation using the data set specified in the constructor. Returns DSL_OKAY on success or an error code on failure.

The internal parameter learning is performed with the em object. The network specified in the constructor does not change its parameters; EM runs on a copy of the network.

The number of folds is specified with the foldCount parameter.

The folds are created by randomly splitting records in the data set into subsets. The random generator is initialized with the randSeed parameter. The value of this parameter defaults to zero, which causes the value based on system clock to be used as seed.

The optional argument progress can be used to stop testing by returning false from DSL_progress::Tick method, which is called periodically within the main loop of the learning algorithm. In such case, the method returns DSL_INTERRUPTED.


int LeaveOneOut(DSL_em &em, DSL_progress *progress = 0);

Performs the Leave-One-Out crossvalidation using the data set specified in the constructor. The network does not change its parameters during the procedure. Returns DSL_OKAY on success or an error code on failure.

The internal parameter learning is performed with the em object. The network specified in the constructor does not change its parameters; EM runs on a copy of the network.

The optional argument progress can be used to stop the testing by returning false from DSL_progress::Tick method, which is called periodically within the main loop of the learning algorithm. In such case, the method returns DSL_INTERRUPTED.


int GetPosteriors(int classNodeHandle, int recordIndex,

    std::vector<double> &posteriors) const;

Fills the posteriors vector with the probabilities calculated for classNodeHandle using the record from the data set with the index specified by the recordIndex.

Returns DSL_OKAY on success or an error code on failure.


int GetAccuracy(int classNodeHandle, int outcome, double &acc) const;

Gets the accuracy for the specified class node and its outcome. Returns DSL_OKAY on success or an error code on failure.


int GetConfusionMatrix(int classNodeHandle, 

    std::vector<std::vector<int> > &matrix) const;

Gets the confusion matrix for the specified class node and its outcome. Returns DSL_OKAY on success or an error code on failure.


int GetPredictedOutcome(int classNodeHandle, int recordIndex) const;

Gets the predicted outcome for the specified class node and record index. Returns DSL_OKAY on success or an error code on failure.


int GetPredictedNode(int recordIndex) const;

int GetPredictedNodeIndex(int recordIndex) const;

Gets the predicted node handle or index for the specifed record index. The node prediction is based on the probabilities of the outcomes in class nodes (essentially, the outcome with the highest probability is chosen). Returns DSL_OKAY on success or an error code on failure.


int GetFoldIndex(int recordIndex) const;

Gets the fold to which the specified data set record belongs. Returns DSL_OKAY on success or an error code on failure.


void GetResultDataset(DSL_dataset &output) const;

Fills the output data set with the content of the input data set (specified in the constructor) and calculated class node probabilities and predictied outcomes.


int CreateROC(int classNodeHandle, int outcomeIndex, 

    std::vector<std::pair<double, double> > &curve, 

    std::vector<double> &thresholds, double &areaUnderCurve) const;

Creates the ROC curve for the specified class node and its outcome. Returns DSL_OKAY on success or an error code on failure.


int CalibrateByBinning(int classNodeHandle, int outcomeIndex, int binCount, 

    std::vector<std::pair<double, double> > &curve, 

    double &hosmerLemeshTest) const;

int CalibrateByMovingAverage(int classNodeHandle, int outcomeIndex, 

    int windowSize, std::vector<std::pair<double, double> > &curve) const;

Create the calibration curve for the specified class node and its outcome. Returns DSL_OKAY on success or an error code on failure.