safe_selection {PheVis} | R Documentation |
safe_selection
Description
Select the variables from dataframe by removing the rare variables and apply 'SAFE' on it.
Usage
safe_selection(
df,
var_surrogate,
surrogate_quali,
threshold = 0.05,
alpha = 0.5,
remove_var_surrogate = TRUE,
bool_weight = FALSE,
...
)
Arguments
df |
dataframe |
var_surrogate |
variables used for building the surrogates |
surrogate_quali |
surrogate with 3 values (0 and 1 the extremes and 3 middle patients) |
threshold |
rareness threshold (default = 0.05). |
alpha |
glmnet parameter (default is 0.5 elastic net) |
remove_var_surrogate |
does the glmnet algorithm should learn on features in var_surrogate (default is TRUE). |
bool_weight |
Should the glmnet function be weighted to balance the extrema populations (default is FALSE). |
... |
arguments to pass to pretty_cv.glmnet |
Value
A list
glmnet_model - A list of three elements: the cv.glmnet fitted model, the coefficients of non zero variables and the vector of non zero coefficient variables.
important_var - A vector with the variables used for the surrogate and the non zero variables.
surrogate_quali - The surrogate_quali argument.