Description Usage Arguments Value See Also Examples
The function does Kfold cross validaton (CV) to choose an optimal pair of (lambda
, alpha
)
on which the model performs best according to the chosen error metric: mean squared error
or mean absolute error.
1 2  rarefit.cv(fitObj, y, X, errtype = "meansquarederror", nfolds = 5,
...)

fitObj 
Output of 
y 
Response variable. 
X 

errtype 
Type of error metric used in cross validation. Available choices are meansquarederror (default) and meanabsoluteerror. 
nfolds 
Number of folds (default is 5) 
... 
Other arguments that can be passed to 
folds 
A length 
errs 
A 
m 
A 
se 
A 
ibest 
Indices of pair of ( 
lambda.best 
Value of 
alpha.best 
Value of 
1 2 3 4 5 6 7 8 9 10 11 12  ## Not run:
# See vignette for more details.
set.seed(100)
ts < sample(1:length(data.rating), 400) # Train set indices
# Fit the model on train set
ourfit < rarefit(y = data.rating[ts], X = data.dtm[ts, ], hc = data.hc, lam.min.ratio = 1e6,
nlam = 20, nalpha = 10, rho = 0.01, eps1 = 1e5, eps2 = 1e5, maxite = 1e4)
# Cross validation
ourfit.cv < rarefit.cv(ourfit, y = data.rating[ts], X = data.dtm[ts, ],
rho = 0.01, eps1 = 1e5, eps2 = 1e5, maxite = 1e4)
## End(Not run)

Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.