Description Usage Arguments Examples
one way to select the best lambda forridgr regressions.
1 2 3 4 5 6 7 | optimization(
form,
dataset,
contrasts = NULL,
lambdas = seq(-2, 2, 0.01),
nfold = 10
)
|
form |
a formula; |
dataset |
a data frame used for the function; |
contrasts |
a list of contrasts for factor variables |
lambdas |
a sequence for selection |
nfold |
number of folds to be used |
1 2 3 4 5 6 7 8 9 10 11 12 | library(rsample)
library(rsample)
library(purrr)
library(foreach)
library(Matrix)
library(glmnet)
library(tibble)
library(doParallel)
registerDoParallel(cores=2)
library(MASS)
data(iris)
fit_linear_model <- optimization(Sepal.Length ~ ., iris, contrasts = list(Species = "contr.sum"), lambda = seq(0, 2, 0.01))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.