0
$\begingroup$

I'm trying to solve a classification problem using a random forest in R. The training data is a particle's charge at 30 different time instances. However, I need to convert this 30 dimensional data into a single value. I've tried using the sum of the charge across the 30 time bins and I've tried using the variable importance to calculate a weighted sum. To clarify, I fitted a random forest to the 30 dimensional training data and then used the resulting variable importance values to assign a weighting to each time interval for the weighted sum.

Then I trained a random forest on the one dimensional data using the sum and the variable importance weighted sum values. However, the random forest performed better when I wasn't using a weighted sum.

I've tried this with the standard randomForest package and the cforest package and I get the same results.

Could anybody explain why the weighted sum doesn't perform better? In principle should using a weighted sum work better?

$\endgroup$

migrated from stackoverflow.com Sep 26 '15 at 13:03

This question came from our site for professional and enthusiast programmers.

  • $\begingroup$ Based on the information you've provided, I'd guess that the weighted sum is essentially throwing away information, reducing classification accuracy. Variable importance is a rough measure of how much each variable contributes to the model and different methods give different relative weights. If you really want to boil down your predictors into a single variable, you might be better off with principal components or partial least squares. But even then, a single predictor is unlikely to contain all the predictive information available from your full data set. $\endgroup$ – eipi10 Sep 25 '15 at 17:04
  • $\begingroup$ I've flagged this to migrate it to CV. But may have something to do with the auto-correlated nature of your time measurements. This probably impacts both the RF and the VI. See Breiman 2001 and Strobl et al 2008 $\endgroup$ – Alex W Sep 25 '15 at 17:30
  • $\begingroup$ random forest (as well as cforest) on the 1-dimentional data makes no sense by the very nature of this algorithm. $\endgroup$ – lanenok Sep 25 '15 at 18:03
1
$\begingroup$

I don't quite get what you're doing (or why), but by training a model on the data and then using the weighted some to train another model on the same data you're going to overfit - if you are tuning any parameters, you'll need to hold out some of your data and then assess performance against that holdout set.

If all you're looking to do is get a single feature that represents the 30 you have, a good way to do so is PCA, and there are many different packages that allow you to do so. Since you're features are likely highly correlated, you should be able to capture a lot of the predictive power with just a few principal components.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.