caretEnsemble icon indicating copy to clipboard operation
caretEnsemble copied to clipboard

center/scale option for caretEnsemble

Open zachmayer opened this issue 10 years ago • 4 comments

Centering and scaling predictions prior to ensembling might help in some degenerate cases. We'd need to make sure to apply the same centering and scaling to the component models prior to predicting too.

zachmayer avatar Dec 12 '14 15:12 zachmayer

This is a big one for me actually -- I have a hacky bit of code that does the center/scale on the frontside, then undoes it when you extract the model frame on the back side so that you can plot predictions on the original scale of the variables. Might be a place to start!

jknowles avatar Dec 12 '14 15:12 jknowles

That's probably the right place to start! I was thinking of using the scale function, and storing the resulting "scaled:center" and "scaled:scale" attributes, e.g.:

x <- scale(matrix(runif(10), ncol=2))
attr(x,"scaled:center")
attr(x,"scaled:scale")

zachmayer avatar Dec 12 '14 16:12 zachmayer

That still leaves us with the "un-center" and "un-scale" problem. Another idea would be to use the caret::preProcess function, which has nice predict methods for new data.

zachmayer avatar Dec 12 '14 16:12 zachmayer

Oh man, it just occurred to me that supporting a pca transformation might be super useful too, as it will yield completely un-correlated predictors.

It might mess up the print and plot methods that assign weights to each of the component models.

zachmayer avatar Dec 12 '14 16:12 zachmayer