| tune_slim {slimrec} | R Documentation |
tune_slim
Description
Arrive at an optimal value of alpha for
slim
Usage
tune_slim(mat, alphaRange = seq(0, 1, 0.1), nonNegCoeff = TRUE,
nfold = 5L, seed, directory, nproc = 1L, progress = TRUE)
Arguments
mat |
(sparse matrix of class 'dgCMatrix') Rating matrix with items along columns and users along rows. |
alphaRange |
(numeric vector) A vector of alpha values with 0 <= alpha <= 1. Default is values 0 to 1, with a difference of 0.1. |
nonNegCoeff |
(flag) Whether the regression coefficients should be non-negative. Default is TRUE. |
nfold |
(positive integer) Number of folds for cross-validation. Only values between(inclusive) 2 and 10 are allowed. |
seed |
(positive integer) Seed to be used to create folds for cross-validation. If missing, a random integer is chosen. Setting this is helpful for reproduciing the results. Default is 5. |
directory |
(string) A writable directory where a sub-directory is
created at the run time and |
nproc |
(positive integer) Number of parallel processes to be used to
compute coefficients for items. If the machine has |
progress |
(flag) If TRUE(default), shows a progress bar and expected time. This is set to TRUE by default. |
Details
Runs nfold cross-validation to aid determining the optimal
value of alpha(see slim for details). The coefficient
matrix obtained from the training fold is used to predict ratings of the
validation fold. The RMSE is evaluated for non-zero ratings and averaged
over all the folds. Note that coefficient matrix is held in memory while
computing RMSE. slim adjusts lambda while fitting an
elastic-net, hence advantages in searching for optimal alpha might
be limited.
Value
A dataframe with two columns: alpha and error.
Examples
require("slimrec")
data(ft_small)
## Not run:
temp <- tune_slim(ft_small)
temp
temp <- tune_slim(ft_small, alphaRange = c(0, 0.5, 1))
temp
temp <- tune_slim(ft_small, alphaRange = c(0, 0.5, 1), nproc = 2)
temp
temp <- tune_slim(ft_small, nonNegCoeff = FALSE)
temp
## End(Not run)