topepo / FES

Code and Resources for "Feature Engineering and Selection: A Practical Approach for Predictive Models" by Kuhn and Johnson
https://bookdown.org/max/FES
GNU General Public License v2.0
716 stars 237 forks source link

02_Predicting_Risk_of_Ischemic_Stroke- Coefficients for RFE model #96

Open rodfloripa opened 4 years ago

rodfloripa commented 4 years ago

Trying to run the recursive feature elimination code I'm not able to see the log regression coefficients for all the RFE models created. The code is the following: https://github.com/topepo/FES/blob/master/02_Predicting_Risk_of_Ischemic_Stroke/02_04_Predictive_Modeling_Across_Sets.R

For example, when I run this code:

set.seed(63331)
img_int_filtered_rfe <- rfe(
  img_int_filtered_recipe,
  data = numericas_train,
  sizes = 1:nrow(img_int_filtered_recipe$var_info)-1,
  rfeControl = rfeCtrl,
  metric = "ROC",
  ## train options
  method = "glm",
  trControl = internal_ctrl
)

And type:
>img_int_filtered_rfe$fit
Thats what I get:
Generalized Linear Model 

30 samples
 1 predictor
 2 classes: 'N', 'Y' 

No pre-processing
Resampling: None 

Why I can't see the coefficients?

I modified the 'functions' parameter from 'caretFuncs' to 'lrFuncs' and now I get the coefficients.

topepo commented 4 years ago

If you look at the class of that object, it is train. If you use img_int_filtered_rfe$fit$finalModel, you should get the glm model