2

I'm using bayesglm for a logistic regression problem. It's a dataset of 150 rows and 2000 variables. I'm trying to do variable selection and usually look at glmnet in caret::rfe. However there isn't a method for bayesglm.

Is there anyway to manually define a method for rfe?

Richie Cotton
  • 118,240
  • 47
  • 247
  • 360
screechOwl
  • 27,310
  • 61
  • 158
  • 267
  • Can you specify is feature selection involves rfeControl() you want to do rfe? and (from caret manual) _Examples of these functions are included in the package: lmFuncs, rfFuncs, treebagFuncs and nbFuncs._, there are no bayesglm functions? Is that right? – java_xof Jan 02 '13 at 22:03

1 Answers1

5

As for the the question I can only think of rewriting lmFuncs$fit function, for example:

lmFuncs$fit<-function (x, y, first, last, ...){   
     tmp <- as.data.frame(x)   
     tmp$y <- y   
 bayesglm (y ~ ., family = gaussian, data = tmp)
}

and then do your rfe.fit with rfeControl(functions = lmFuncs)

java_xof
  • 439
  • 4
  • 16
  • awesome. I didn't know you could rewrite the functions. thank you very much. – screechOwl Jan 02 '13 at 22:25
  • Hope it will do the trick! I use caret for feature selection but instead of rewriting functions I use all possible regression/classification training methods available from caret and then I call either rfe() function or predict() with fitted model. And then I assume which features to explicit from final model (mostly ANN). – java_xof Jan 02 '13 at 22:34