[R] RandomForest ... Always Returning a 1?

Peter Langfelder peter.langfelder at gmail.com
Mon Feb 6 06:17:20 CET 2012


Well, if you look at your data more carefully, you will see that the
histogram of y is heavily skewed towards 1 (small values). The 91/625
quantile is still 1 (there are 192 1s). It is therefore not surprising
that RF comes up with mostly 1s (in my attempt it came up with two 2s,
but that is a bit random seed dependent), and that the regression also
gives you values close to 1 - that's what you are most likely to get
if were to randomly sample 91 rows from the 625 rows in x. Note
further that the predictors seem to contain very little signal (i.e.,
y is mostly independent of all of the x), which also (usually)
"biases" the predictor towards the "middle" value, which in this case
is 1.

HTH

Peter

On Sun, Feb 5, 2012 at 8:24 PM, apresley <anthony at resolution.com> wrote:
> We have a pretty simple R forecasting problem, using randomForest.  Our
> script is below.  We have data with about 6 columns, and 625 rows to do the
> training on, and then we're trying to forecast 90 or so rows.
>
> The x matrix has 3 years worth of sales data, starting at 6:15am.  However,
> for some reason, it's always returning a "1", when predicting any data.
>
> I've tried removing the first two columns, and the last column, which will
> always be the same for both the predicted and training data.  That gets me a
> mix of 1's and 2's.
>
> If I do a regression, it's a little better, but only has a range of about
> 2.4 -> 5 ... whereas the original data is a wide range / variance, of
> anywhere from 1 to 30.
>
> What can I do to get some variance into this returned data?
>
>
> library ('randomForest');
>
> x <- matrix(data =
> c(6,15,4,23,6,26,6,15,5,2,7,26,6,15,8,10,1,26,6,15,1,30,6,26,6,15,11,26,6,26,6,15,8,1,1,26,6,15,6,5,5,26,6,15,11,5,4,26,6,15,6,28,1,26,6,15,6,25,5,26,6,15,5,7,4,26,6,15,9,17,5,26,6,15,10,6,3,26,6,15,7,28,3,26,6,15,1,15,6,26,6,15,4,22,4,26,6,15,3,28,1,26,6,15,7,29,4,26,6,15,12,1,4,26,6,15,12,14,3,26,6,15,9,9,4,26,6,15,2,18,5,26,6,15,9,11,7,26,6,15,6,17,5,26,6,15,10,15,6,26,6,15,8,2,1,26,6,15,3,8,2,26,6,15,5,6,4,26,6,15,10,7,5,26,6,15,2,23,2,26,6,15,8,15,7,26,6,15,5,26,3,26,6,15,3,16,3,26,6,15,1,12,2,26,6,15,3,15,2,26,6,15,5,21,4,26,6,15,10,30,6,26,6,15,11,4,5,26,6,15,10,27,4,26,6,15,9,30,4,26,6,15,6,14,2,26,6,15,5,16,6,26,6,15,11,6,5,26,6,15,11,7,7,26,6,15,7,9,6,26,6,15,12,31,4,26,6,15,9,13,1,26,6,15,9,27,2,26,6,15,9,18,6,26,6,15,12,7,1,26,6,15,12,5,6,26,6,15,9,6,1,26,6,15,1,13,3,26,6,15,10,29,4,26,6,15,5,14,6,26,6,15,8,26,4,26,6,15,9,5,7,26,6,15,1,10,7,26,6,15,9,24,6,26,6,15,10,9,6,26,6,15,6,12,5,26,6,15,11,13,6,26,6,15,8,18,4,26,6,15,2,15,1,26,6,15,3,25,5,26,6,15,6,23,3,26,!
>  6,15,6,15,1,26,6,15,10,10,1,26,6,15,7,26,7,26,6,15,5,3,1,26,6,15,6,13,7,26,6,15,12,14,2,26,6,15,12,8,3,26,6,15,4,20,3,26,6,15,4,16,5,26,6,15,8,7,5,26,6,15,10,28,3,26,6,15,5,11,2,26,6,15,7,23,5,26,6,15,12,14,1,26,6,15,12,4,7,26,6,15,5,23,6,26,6,15,9,7,2,26,6,15,11,10,4,26,6,15,8,19,5,26,6,15,8,30,2,26,6,15,7,5,7,26,6,15,3,27,6,26,6,15,2,7,1,26,6,15,8,8,6,26,6,15,7,12,2,26,6,15,10,4,2,26,6,15,6,9,3,26,6,15,3,19,6,26,6,15,12,19,6,26,6,15,8,18,3,26,6,15,6,14,7,26,6,15,9,16,5,26,6,15,7,11,6,26,6,15,7,31,6,26,6,15,4,9,5,26,6,15,10,25,2,26,6,15,11,7,1,26,6,15,12,31,6,26,6,15,9,13,2,26,6,15,8,13,6,26,6,15,2,4,5,26,6,15,6,1,1,26,6,15,6,20,1,26,6,15,12,12,1,26,6,15,5,28,6,26,6,15,9,8,4,26,6,15,8,11,4,26,6,15,9,15,3,26,6,15,11,28,1,26,6,15,9,25,5,26,6,15,11,11,4,26,6,15,8,30,7,26,6,15,7,28,2,26,6,15,2,26,6,26,6,15,4,18,1,26,6,15,1,4,2,26,6,15,10,2,5,26,6,15,6,19,6,26,6,15,3,10,4,26,6,15,1,13,4,26,6,15,7,7,2,26,6,15,12,18,6,26,6,15,6,18,5,26,6,15,10,7,3,26,6,15,9,30,5,26,6,15,5,10,2,26!
>  ,6,15,6,24,5,26,6,15,12,23,4,26,6,15,9,15,2,26,6,15,11,14,1,26,6,15,6,
> 19,5,26,6,15,9,27,1,26,6,15,7,12,1,26,6,15,10,7,4,26,6,15,8,19,3,26,6,15,7,24,5,26,6,15,8,20,4,26,6,15,11,20,5,26,6,15,3,7,7,26,6,15,7,19,7,26,6,15,2,5,5,26,6,15,9,8,2,26,6,15,11,2,1,26,6,15,2,21,1,26,6,15,9,18,5,26,6,15,9,1,3,26,6,15,3,5,6,26,6,15,5,27,4,26,6,15,12,17,4,26,6,15,8,17,3,26,6,15,7,20,2,26,6,15,7,21,4,26,6,15,3,29,2,26,6,15,3,10,3,26,6,15,1,16,6,26,6,15,3,24,4,26,6,15,3,14,7,26,6,15,11,6,6,26,6,15,6,19,7,26,6,15,6,2,2,26,6,15,5,17,1,26,6,15,9,3,4,26,6,15,6,26,7,26,6,15,8,13,5,26,6,15,11,14,7,26,6,15,8,31,2,26,6,15,7,4,7,26,6,15,6,1,2,26,6,15,12,2,5,26,6,15,4,10,6,26,6,15,3,12,5,26,6,15,10,13,2,26,6,15,2,19,5,26,6,15,6,15,2,26,6,15,11,26,4,26,6,15,12,15,3,26,6,15,5,9,7,26,6,15,12,13,2,26,6,15,6,8,1,26,6,15,3,20,7,26,6,15,11,4,4,26,6,15,6,20,7,26,6,15,12,3,4,26,6,15,6,30,3,26,6,15,8,5,4,26,6,15,9,25,6,26,6,15,6,27,1,26,6,15,3,3,4,26,6,15,6,21,2,26,6,15,8,29,7,26,6,15,7,29,3,26,6,15,6,23,2,26,6,15,2,27,6,26,6,15,4,19,2,26,6,15,1,12,3,26,6,15,7,18,1,26,6,15,6,25,6,!
>  26,6,15,7,2,6,26,6,15,12,21,2,26,6,15,11,16,2,26,6,15,12,19,7,26,6,15,2,24,3,26,6,15,11,15,2,26,6,15,3,22,2,26,6,15,4,8,4,26,6,15,11,23,1,26,6,15,12,29,3,26,6,15,9,16,3,26,6,15,6,11,4,26,6,15,2,10,3,26,6,15,7,27,1,26,6,15,10,23,6,26,6,15,1,21,5,26,6,15,12,19,1,26,6,15,4,22,5,26,6,15,2,1,1,26,6,15,10,21,3,26,6,15,10,16,6,26,6,15,2,12,6,26,6,15,12,8,2,26,6,15,6,5,6,26,6,15,4,8,5,26,6,15,4,15,4,26,6,15,8,3,1,26,6,15,10,31,7,26,6,15,10,21,5,26,6,15,6,11,5,26,6,15,7,11,1,26,6,15,2,18,4,26,6,15,10,14,5,26,6,15,11,25,4,26,6,15,1,27,3,26,6,15,9,21,1,26,6,15,6,22,1,26,6,15,9,27,7,26,6,15,4,14,4,26,6,15,5,23,1,26,6,15,8,5,3,26,6,15,10,28,4,26,6,15,12,20,1,26,6,15,9,19,1,26,6,15,3,8,1,26,6,15,5,29,6,26,6,15,3,11,5,26,6,15,8,16,2,26,6,15,6,24,3,26,6,15,9,22,3,26,6,15,9,4,6,26,6,15,2,27,7,26,6,15,10,12,3,26,6,15,5,20,3,26,6,15,8,26,5,26,6,15,8,8,1,26,6,15,12,23,3,26,6,15,7,17,7,26,6,15,12,22,2,26,6,15,9,26,6,26,6,15,8,24,1,26,6,15,7,13,2,26,6,15,9,29,2,26,6,15,7,19,2,26,6,15,5,31,7,26,6!
>  ,15,10,22,6,26,6,15,11,8,7,26,6,15,8,5,5,26,6,15,5,18,3,26,6,15,5,11,1
> ,26,6,15,9,28,1,26,6,15,7,30,6,26,6,15,5,18,2,26,6,15,6,3,4,26,6,15,7,5,2,26,6,15,2,5,6,26,6,15,7,15,3,26,6,15,4,29,5,26,6,15,2,6,6,26,6,15,11,15,1,26,6,15,11,16,3,26,6,15,9,18,7,26,6,15,3,18,5,26,6,15,4,5,2,26,6,15,10,13,3,26,6,15,9,20,2,26,6,15,11,21,6,26,6,15,3,6,7,26,6,15,1,28,4,26,6,15,9,10,4,26,6,15,11,30,1,26,6,15,10,18,7,26,6,15,7,16,4,26,6,15,12,21,1,26,6,15,3,9,2,26,6,15,5,26,4,26,6,15,12,1,2,26,6,15,6,17,4,26,6,15,2,19,6,26,6,15,10,3,6,26,6,15,7,2,5,26,6,15,1,23,7,26,6,15,10,20,4,26,6,15,7,3,6,26,6,15,7,28,4,26,6,15,4,18,7,26,6,15,7,24,7,26,6,15,5,19,4,26,6,15,7,22,4,26,6,15,7,30,5,26,6,15,3,16,2,26,6,15,8,4,4,26,6,15,1,7,4,26,6,15,4,10,7,26,6,15,5,9,6,26,6,15,8,29,6,26,6,15,5,19,2,26,6,15,8,15,1,26,6,15,4,7,4,26,6,15,2,3,4,26,6,15,2,2,3,26,6,15,12,2,3,26,6,15,9,12,6,26,6,15,5,5,2,26,6,15,5,20,4,26,6,15,7,16,6,26,6,15,1,14,4,26,6,15,11,25,3,26,6,15,9,19,7,26,6,15,3,9,3,26,6,15,7,6,1,26,6,15,6,6,6,26,6,15,2,25,5,26,6,15,3,19,5,26,6,15,10,4,7,26,6,15,1,18,2,26,6,15,!
>  2,16,3,26,6,15,1,26,3,26,6,15,8,6,5,26,6,15,11,18,3,26,6,15,8,27,4,26,6,15,1,2,6,26,6,15,6,16,4,26,6,15,6,28,2,26,6,15,9,14,1,26,6,15,8,6,4,26,6,15,8,25,2,26,6,15,12,20,2,26,6,15,7,29,5,26,6,15,6,12,7,26,6,15,1,26,2,26,6,15,10,10,7,26,6,15,12,12,7,26,6,15,3,31,4,26,6,15,11,24,2,26,6,15,3,23,3,26,6,15,12,11,6,26,6,15,7,25,7,26,6,15,7,10,5,26,6,15,6,4,6,26,6,15,11,15,7,26,6,15,12,9,4,26,6,15,8,12,3,26,6,15,4,12,1,26,6,15,8,27,6,26,6,15,5,12,2,26,6,15,7,14,2,26,6,15,5,4,2,26,6,15,1,17,7,26,6,15,5,27,5,26,6,15,8,27,5,26,6,15,10,4,1,26,6,15,11,10,2,26,6,15,12,27,2,26,6,15,1,29,6,26,6,15,12,11,7,26,6,15,8,11,3,26,6,15,1,24,1,26,6,15,9,19,6,26,6,15,12,27,1,26,6,15,8,18,2,26,6,15,12,30,5,26,6,15,11,16,1,26,6,15,3,1,2,26,6,15,6,18,6,26,6,15,8,30,1,26,6,15,12,4,6,26,6,15,8,22,7,26,6,15,10,27,3,26,6,15,1,5,3,26,6,15,11,7,6,26,6,15,11,29,1,26,6,15,12,6,1,26,6,15,10,18,2,26,6,15,8,28,5,26,6,15,11,29,2,26,6,15,2,11,4,26,6,15,8,1,6,26,6,15,5,27,3,26,6,15,10,17,7,26,6,15,11,12,5,26,6,15,4,!
>  17,7,26,6,15,10,17,1,26,6,15,7,23,6,26,6,15,12,24,6,26,6,15,7,21,2,26,
> 6,15,6,29,2,26,6,15,6,10,3,26,6,15,10,12,1,26,6,15,6,13,1,26,6,15,8,21,6,26,6,15,10,10,6,26,6,15,9,3,5,26,6,15,7,21,3,26,6,15,9,2,4,26,6,15,12,16,4,26,6,15,5,22,6,26,6,15,8,14,5,26,6,15,9,1,4,26,6,15,10,16,5,26,6,15,5,15,5,26,6,15,4,16,6,26,6,15,11,20,6,26,6,15,10,3,7,26,6,15,4,20,2,26,6,15,11,24,4,26,6,15,10,30,7,26,6,15,12,22,3,26,6,15,4,21,3,26,6,15,11,28,7,26,6,15,9,22,4,26,6,15,4,1,5,26,6,15,11,9,1,26,6,15,11,18,4,26,6,15,3,20,6,26,6,15,6,21,7,26,6,15,12,22,4,26,6,15,6,13,6,26,6,15,7,18,7,26,6,15,10,19,1,26,6,15,7,30,4,26,6,15,9,21,3,26,6,15,11,1,2,26,6,15,6,11,6,26,6,15,8,26,3,26,6,15,2,17,3,26,6,15,8,20,6,26,6,15,4,21,4,26,6,15,8,11,2,26,6,15,6,30,4,26,6,15,2,20,6,26,6,15,10,5,3,26,6,15,3,12,6,26,6,15,3,3,3,26,6,15,6,9,2,26,6,15,4,30,6,26,6,15,10,25,7,26,6,15,10,6,2,26,6,15,10,29,6,26,6,15,7,9,4,26,6,15,7,13,1,26,6,15,1,3,1,26,6,15,3,13,6,26,6,15,5,15,6,26,6,15,11,4,3,26,6,15,12,3,5,26,6,15,5,29,7,26,6,15,11,14,6,26,6,15,8,17,2,26,6,15,12,17,5,26,6,15,6,16,2,26,6,15,6!
>  ,10,5,26,6,15,6,27,7,26,6,15,10,23,7,26,6,15,5,24,2,26,6,15,11,3,2,26,6,15,12,29,2,26,6,15,11,17,3,26,6,15,4,3,6,26,6,15,1,22,5,26,6,15,2,2,2,26,6,15,2,13,6,26,6,15,4,5,1,26,6,15,6,4,4,26,6,15,5,13,5,26,6,15,1,28,5,26,6,15,2,26,5,26,6,15,6,20,6,26,6,15,3,17,3,26,6,15,11,3,4,26,6,15,12,9,5,26,6,15,10,1,6,26,6,15,8,31,1,26,6,15,6,15,3,26,6,15,8,31,3,26,6,15,10,16,7,26,6,15,7,7,4,26,6,15,6,3,5,26,6,15,12,23,5,26,6,15,4,26,2,26,6,15,5,16,1,26,6,15,6,3,3,26,6,15,11,30,3,26,6,15,11,8,2,26,6,15,12,11,5,26,6,15,10,15,4,26,6,15,12,2,4,26,6,15,6,7,1,26,6,15,4,6,3,26,6,15,3,30,3,26,6,15,11,19,6,26,6,15,8,14,6,26,6,15,12,28,3,26,6,15,4,17,6,26,6,15,8,2,7,26,6,15,10,28,5,26,6,15,8,29,1,26,6,15,7,1,5,26,6,15,12,29,4,26,6,15,10,24,1,26,6,15,7,12,7,26,6,15,12,30,3,26,6,15,8,25,3,26,6,15,6,12,6,26,6,15,9,29,3,26,6,15,8,4,3,26,6,15,8,13,4,26,6,15,11,13,5,26,6,15,8,20,5,26,6,15,5,31,2,26,6,15,11,5,5,26,6,15,7,22,3,26,6,15,10,14,4,26,6,15,6,22,2,26,6,15,7,20,3,26,6,15,2,24,4,26,6,15,7,26,1,26,!
>  6,15,6,28,7,26,6,15,12,9,3,26,6,15,3,26,6,26,6,15,11,30,2,26,6,15,9,13
> ,7,26,6,15,8,24,3,26,6,15,12,31,5,26,6,15,4,6,2,26,6,15,9,11,6,26,6,15,4,27,2,26,6,15,1,21,4,26,6,15,7,17,6,26,6,15,11,19,4,26,6,15,11,18,5,26,6,15,2,22,1,26,6,15,6,26,6,26,6,15,4,28,3,26,6,15,9,17,4,26,6,15,9,9,3,26,6,15,12,10,6,26,6,15,10,11,7,26,6,15,4,28,4,26,6,15,7,18,6,26,6,15,1,22,6,26,6,15,5,10,7,26,6,15,9,29,4,26,6,15,11,2,3,26,6,15,7,6,3,26,6,15,3,5,5,26,6,15,7,8,5,26,6,15,8,19,4,26,6,15,7,8,4,26,6,15,11,17,2,26,6,15,7,24,6,26,6,15,11,8,1,26,6,15,7,25,6,26,6,15,11,22,2,26,6,15,12,18,5,26,6,15,5,12,4,26,6,15,7,22,5,26,6,15,8,22,6,26,6,15,8,24,2,26,6,15,11,1,7,26,6,15,4,25,7,26,6,15,5,11,3,26,6,15,8,12,5,26,6,15,10,23,5,26,6,15,10,9,5,26,6,15,1,15,5,26,6,15,8,14,7,26,6,15,1,11,2,26,6,15,4,14,3,26,6,15,6,22,3,26,6,15,1,25,2,26,6,15,7,4,1,26,6,15,11,23,2,26,6,15,8,2,2,26,6,15,1,19,2,26,6,15,8,23,1,26,6,15,1,25,1,26,6,15,9,17,6,26,6,15,12,8,4,26,6,15,11,6,7,26,6,15,6,23,4,26,6,15,3,15,1,26,6,15,7,1,4,26,6,15,1,3,7,26,6,15,12,3,6,26,6,15,4,27,3,26,6,15,11,17,4,26,6,15,11!
>  ,12,4,26,6,15,3,31,3,26,6,15,6,25,4,26,6,15,12,4,5,26,6,15,9,2,3,26,6,15,9,6,7,26,6,15,5,21,6,26,6,15,8,4,2,26,6,15,9,4,5,26,6,15,3,23,2,26,6,15,2,9,2,26,6,15,10,1,5,26,6,15,4,29,4,26,6,15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.0,1.0,4.
> 0,1.0,3.0,2.0,3.0,6.0,6.0,1.0,8.0,5.0,2.0,6.0,3.0,1.0,1.0,1.0,1.0,14.0,1.0,7.0,12.0,3.0,9.0,8.0,1.0,5.0,2.0,3.0,1.0,2.0,2.0,13.0,3.0,1.0,5.0,8.0,1.0,5.0,3.0,7.0,1.0,1.0,2.0,1.0,6.0,2.0,2.0,7.0,5.0,1.0,3.0,1.0,2.0,1.0,1.0,2.0,3.0,1.0,9.0,5.0,14.0,2.0,4.0,5.0,3.0,2.0,10.0,14.0,5.0,3.0,1.0,1.0,3.0,2.0,2.0,2.0,2.0,2.0,4.0,10.0,10.0,1.0,5.0,1.0,1.0,4.0,6.0,1.0,13.0,3.0,3.0,2.0,1.0,1.0,4.0,1.0,1.0,1.0,5.0,3.0,1.0,5.0,2.0,2.0,3.0,12.0,8.0,2.0,1.0,6.0,3.0,1.0,1.0,1.0,2.0,4.0,2.0,9.0,2.0,3.0,2.0,9.0,2.0,2.0,7.0,20.0,1.0,2.0));
>
> z <-
> matrix(data=c(6,15,1,1,7,26,6,15,1,2,1,26,6,15,1,3,2,26,6,15,1,4,3,26,6,15,1,5,4,26,6,15,1,6,5,26,6,15,1,7,6,26,6,15,1,8,7,26,6,15,1,9,1,26,6,15,1,10,2,26,6,15,1,11,3,26,6,15,1,12,4,26,6,15,1,13,5,26,6,15,1,14,6,26,6,15,1,15,7,26,6,15,1,16,1,26,6,15,1,17,2,26,6,15,1,18,3,26,6,15,1,19,4,26,6,15,1,20,5,26,6,15,1,21,6,26,6,15,1,22,7,26,6,15,1,23,1,26,6,15,1,24,2,26,6,15,1,25,3,26,6,15,1,26,4,26,6,15,1,27,5,26,6,15,1,28,6,26,6,15,1,29,7,26,6,15,1,30,1,26,6,15,1,31,2,26,6,15,2,1,3,26,6,15,2,2,4,26,6,15,2,3,5,26,6,15,2,4,6,26,6,15,2,5,7,26,6,15,2,6,1,26,6,15,2,7,2,26,6,15,2,8,3,26,6,15,2,9,4,26,6,15,2,10,5,26,6,15,2,11,6,26,6,15,2,12,7,26,6,15,2,13,1,26,6,15,2,14,2,26,6,15,2,15,3,26,6,15,2,16,4,26,6,15,2,17,5,26,6,15,2,18,6,26,6,15,2,19,7,26,6,15,2,20,1,26,6,15,2,21,2,26,6,15,2,22,3,26,6,15,2,23,4,26,6,15,2,24,5,26,6,15,2,25,6,26,6,15,2,26,7,26,6,15,2,27,1,26,6,15,2,28,2,26,6,15,2,29,3,26,6,15,3,1,4,26,6,15,3,2,5,26,6,15,3,3,6,26,6,15,3,4,7,26,6,15,3,5,1,26,6,15,3,6,2,26,6,15,3,7,!
>  3,26,6,15,3,8,4,26,6,15,3,9,5,26,6,15,3,10,6,26,6,15,3,11,7,26,6,15,3,12,1,26,6,15,3,13,2,26,6,15,3,14,3,26,6,15,3,15,4,26,6,15,3,16,5,26,6,15,3,17,6,26,6,15,3,18,7,26,6,15,3,19,1,26,6,15,3,20,2,26,6,15,3,21,3,26,6,15,3,22,4,26,6,15,3,23,5,26,6,15,3,24,6,26,6,15,3,25,7,26,6,15,3,26,1,26,6,15,3,27,2,26,6,15,3,28,3,26,6,15,3,29,4,26,6,15,3,30,5,26,6,15,3,31,6,26),
> nrow=91, ncol=6, byrow=TRUE);
>
> model <- randomForest (x, y);
>
> t <- factor (predict(model, z, type='response', predict.all=FALSE));
>
> ..............
>
> --
> Anthony
>
> --
> View this message in context: http://r.789695.n4.nabble.com/RandomForest-Always-Returning-a-1-tp4360406p4360406.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list