Learn R Programming

gRapfa (version 1.0)

cross.validate: K - cross validation

Description

The function measures the prediction efficiency of the model using K-fold cross-validation.

Usage

cross.validate(Data, K = 10, crit = NULL, beagle = TRUE, dir='')

Arguments

Data
A data frame
K
Number of cross validations
crit
The model selection criterion, either AIC or BIC, for penalised likelihood method.
beagle
If beagle=TRUE, the function performs model selection using BEAGLE.
dir
specifying the path for 'beagle.jar' directory.

Value

Returns per symbol loglikelihood of the K-cross validation.

Details

The cross validation for a given data frame is done as follows,\ 1. The data is divided in to K subsets of equal sizes.\ 2. At each cross validation step in k=1:K, $k^th$ subset is taken as the test data and the rest as training data.\ 3. APFA model is fitted to the training data using a model selection method (AIC, BIC or Beagle), then using the edge probabilities of the fitted model, the loglikelihood and the per-symbol loglikelihood are calculated for the test data set.\ 4. The function returns the mean of the log-likelihood from K-cross validation and pzero. \

References

Thollard, F.; Dupont, P. & de la Higuera, C. Probabilistic DFA Inference using Kullback-Leibler Divergence and Minimality 17th International Conference on Machine Learning., 2000, 975-982\

Examples

Run this code
library(gRapfa)
data(Wheeze)


Run the code above in your browser using DataLab