crossVal {bbl}  R Documentation 
CrossValidation of BB Learning
Description
Run multiple fittings of bbl
model with training/validation
division of data
Usage
crossVal(
formula,
data,
weights,
novarOk = FALSE,
lambda = 1e05,
lambdah = 0,
eps = 0.9,
nfold = 5,
method = "pseudo",
use.auc = TRUE,
verbose = 1,
progress.bar = FALSE,
storeOpt = TRUE,
...
)
Arguments
formula 
Formula for model. Note that intercept has no effect. 
data 
Data frame of data. Column names must match 
weights 
Frequency vector of how many times each row of 
novarOk 
Proceed even when there are predictors with only one factor level. 
lambda 
Vector of L2 penalizer values for 
lambdah 
L2 penalizer in 
eps 
Vector of regularization parameters, 
nfold 
Number of folds for training/validation split. 
method 

use.auc 
Use AUC as the measure of prediction accuracy. Only works
if response groups are binary. If 
verbose 
Verbosity level. Downgraded when relayed into 
progress.bar 
Display progress bar in 
storeOpt 
Store the optimal fitted object of class 
... 
Other parameters to 
Details
The data
slot of object
is split into training and validation
subsets of (nfold
1):1 ratio. The model is trained with the
former and validated on the latter. Individual division/fold results are
combined into validation result for all instances in the data set and
prediction score is evaluated using the known response group
identity.
Value
Object of class cv.bbl
extending bbl
, a list
with extra components:
regstar
, Value of regularization parameter, lambda
and eps
for method='pseudo'
and method='mf'
,respectively,
at which the accuracy score is maximized;
maxscore
, Value of maximum accuracy;
cvframe
, Data frame of regularization parameters and scores scanned.
If use.auc=TRUE
, also contains 95
Examples
set.seed(513)
m < 5
n < 100
predictors < list()
for(i in 1:m) predictors[[i]] < c('a','c','g','t')
names(predictors) < paste0('v',1:m)
par < list(randompar(predictors), randompar(predictors, h0=0.1, J0=0.1))
dat < randomsamp(predictors, response=c('ctrl','case'), par=par, nsample=n)
cv < crossVal(y ~ .^2, data=dat, method='mf', eps=seq(0.1,0.9,0.1))
cv