Closed zachmayer closed 3 months ago
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!
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")
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.
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.
caretStack supports all the preprcoessing options for caret::train now
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.