cross.val: cross.val Runs k-fold cross validation via rolling window....

Description Usage Arguments Value Examples

Description

cross.val Runs k-fold cross validation via rolling window. Any required libraries to run the classification algorithm should already be loaded.

Usage

1
cross.val(model.function, model.args = list(), data.train, no.subsets = 5)

Arguments

model.function

function name of the classification algorithm call

model.args

arguments to pass to the function call

data.train

data frame or matrix of training data, depending on what the algorithm requires

no.subsets

number of folds to run cross-validation on. Defaults to 5.

Value

list(rates, mean.rates) - percentage successful predictions and mean success rate of training and testing no.subsets

Examples

1
2
3
4
5
6
# Example with multinom
# cross.val(model.function = multinom, model.args = list(formula = popularity ~ ., data = training), data = training)
# $rates
# [1] 0.4941667 0.4810417 0.4658333 0.4770833 0.4935417
# $mean.rate
# [1] 0.4823333

abarciauskas-bgse/cphtbo documentation built on May 10, 2019, 4:09 a.m.