topepo / caret

caret (Classification And Regression Training) R package that contains misc functions for training and plotting classification and regression models
http://topepo.github.io/caret/index.html
1.61k stars 634 forks source link

Potential Fix For VarImp To Work With Categorical Models Such as Method pda #1355

Open thomashigginsdatascientist opened 7 months ago

thomashigginsdatascientist commented 7 months ago

insert on line 134 filterVarImp:

y_unlist = unlist(y)

change line 135 filterVarImp:

outStat <- apply(x, 2, testFunc, y = y_unlist)

insert on line 23 of varImp.train:

y_numeric <- is.numeric(y_dat) if(y_numeric){ }else{ y_dat$.outcome <- as.factor(y_dat$.outcome) y_dat$.outcome <- as.numeric(y_dat$.outcome) } filterVarImp varImp train