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
724 stars 237 forks source link

Ch. 21 and 22 - Small suggestion #81

Closed gtalckmin closed 4 years ago

gtalckmin commented 4 years ago

Hello Max,

First, let me acknowledge how beneficial both of your books are to my research.

If I am allowed a suggestion, I reckon that chapters 21 and 22, despite extensively explaining the workflow for feature selection, may not explicitly show to users how to pass a caretGA/train (for all caret model) feature selection as well as changing basic GA parameters (mutation, cross-over etc).

A quick google search will show that there is a lot of people using rfGA for feature selection and later running a glm on top of the selected features. Not sure that is the intention.

Cheers,

gtalckmin commented 4 years ago

Also, it would be great to know how you plot the contour plots for desirability vs RMSE on that chapters.

gtalckmin commented 4 years ago
library(desirability)
library(viridisLite)
functionRMSE<- desirability::dMin(30,75,1)
functionSize <- desirability::dMin(3, 15, 0.5)
xgrid<- seq(min(functionRMSE$low), max((functionRMSE$high), 0.5))
ygrid<- seq(min(functionSize$low), max(functionSize$high), 0.5)
data.fit <-  expand.grid(x = xgrid, y = ygrid )
overall <- desirability::dOverall(functionRMSE, functionSize)

D <- predict(overall, data.fit)
DM<-matrix(c(D), ncol=length(ygrid), nrow=length(xgrid))

coul <- viridis(100)
lattice::levelplot(DM, col.regions=coul, contour=T, labels=T, interpolate=T, cuts= 20, region=T, pretty=T)