0
$\begingroup$

The random forest model is simply voting the response variable to be one class and the error rate is 19.22%. The rate is impressive, but I'm just wondering how I can make the model favor the second row and column more? Thanks.

randomForest(formula = y1 ~ . - y1, data = df1, ntree = 20000) 
           Type of random forest: classification
                 Number of trees: 20000
No. of variables tried at each split: 7

    OOB estimate of  error rate: 19.22%
Confusion matrix:
     0 1 class.error
0 5219 0           0
1 1242 0           1
$\endgroup$

closed as unclear what you're asking by Sycorax, Michael Chernick, Matthew Gunn, gung, John Jan 28 '17 at 8:50

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 1
    $\begingroup$ This usually happens when your classes are highly skewed. Look into methods for handling class skew. Undersampling and oversampling are two straightforward approaches. $\endgroup$ – Prometheus Jan 27 '17 at 21:17
  • 3
    $\begingroup$ This is not a heavily skewed sample. From the confusion matrix we see that we have ~1.24K positive samples out of a total ~6.46K item sample; 19.2% positives while clearly imbalanced is far from "heavily skewed". A much more plausible issue is having substantial overlap between classes in the feature space explored. $\endgroup$ – usεr11852 Jan 27 '17 at 21:40
  • 1
    $\begingroup$ It looks like your confusion matrix is based on an arbitrary threashold of 0.5. You need to put work into tuning your threshold. Your class imbalance is not an issue. $\endgroup$ – Matthew Drury Jan 28 '17 at 1:36
  • $\begingroup$ To definitively answer this, we will need more information (along the lines of the comments). $\endgroup$ – gung Jan 28 '17 at 2:32
1
$\begingroup$

Looks like you've got a high base rate (high accuracy if you just predict the same answer). In addition to under/oversampling, because you have binary outcomes, I'd suggest looking into the Matthews Correlation Coefficient for evaluating your model's performance. It's a well-known metric for imbalanced classes.

$\endgroup$

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