Description Usage Arguments Examples
LASSO model fit This function train LASSO model on train set and test on test set and evaluate model fit
1 2 | LASSO_model2_fit(train, test, m_id_sort, i, eval = "r2",
num_folds = 10)
|
train |
training dataset |
test |
test dataset |
m_id_sort |
metabolite name vector |
i |
response metabolite's index, used in for loop |
eval |
model fit evaluation, options are r-squared and MSE. Default to r-squared |
number |
of folds in lasso cv Default to 10 folds |
1 2 3 4 5 6 7 | MSE <- c()
r2<- c()
for (i in (1:length(m_id_sort))){
set.seed(1)
MSE[i] <- LASSO_model2_fit(train, test, m_id_sort, i, eval = "mse")
r2[i] <- LASSO_model2_fit(train, test, m_id_sort, i, eval = "r2")
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.