SchlossLab/mikropml

Extracting weights from 100 iterations and from random random forset model

Closed this issue · 1 comments

Hi there, first of all thanks a lot for developing mikropml package it made machine learning with microbiome data easier for people with limited bioinformatic experience.

I do have two questions and would be great if you could help.

Is there is way to extract the weight from 100 iterations so I can calculate the median and IQR ?

I manged to extract the weight from one iteration only using the following code:

feno_results_glment <- run_ml(preprocessed_feno_con, method = "glmnet",
outcome_colname = "feno", seed = 1990)

model <- feno_results_glment %>% _pluck("trained_model")

data <- coef(model$finalModel, model$bestTune$lambda) %>% as.matrix() %>%
as_tibble(rownames = "feature" ) %>% rename(weight = s1)

When use the below code I can't get weight from 100 iterations

_test_hp <- list(alpha = 0, lambda = c(0.05, 0.1,1,2,3))

get_feno_results_hp <- function(seed){

run_ml(preprocessed_feno, method = "glmnet",
outcome_colname = "feno",
seed = seed)
}
plan ("multisession", workers= 4)

iterative_run_ml_100_splits <- future_map(1:100, get_feno_results_hp,
.options = furrr_options(seed= TRUE))_

Is it possible to extract the weight from the Random forest model and How ?

I'm closing this issue since this is already a discussion here: #316