I am working on multiclass-imbalanced data. My dependent variable is highly skewed.


2(No Injury)         208753
1(Medium Injury)      22318
0(severe Injury)       3394

I have used random forest algorithm with parameter "class_weight='balanced' " to manage the class 2 imbalance.

I get the below results when I use average='micro'.

 [[   34   107   688]
  [  148   778  4592]
  [  905  4635 46730]]
 Accuracy Score: 0.8110616374089428
 precision score: 0.8110616374089428
 Recall score: 0.8110616374089428
 AUC Score: 0.8582962280567071
 F1 score: 0.8110616374089428
 Kappa Score: 0.05522284663052324 

For the average = 'macro', the results are below.

[[   31   125   684]
 [  157   838  4559]
 [  890  4694 46639]]
 Accuracy Score: 0.8104816009007626
 precision score: 0.3586119227436326
 Recall score: 0.3602869806251181
 AUC Score: 0.5253225798824679
 F1 score: 0.3592735337079687
 Kappa Score: 0.06376296115668922

So, which results should I consider to evaluate the model? If I have to consider the macro, then my model performance is really bad. Please suggest if there are any methods to improve the precision, recall and AUC score?

If I consider micro results, my precision, recall, f1 score is same. How can I justify this in the project?

I am interested in medium and severe injuries. But individual class precisions 0.0312(severe), 0.1409(medium) for macro are very low. The overall precision score is also very low 0.35. Is it possible to increase these scores? Or Is it fine to consider these low values as my final results for the project? Any suggestions are greatly appreciated. NOTE: I have tried SMOTE oversampling and ensemble cross-validation with different algorithms but I ended up having precision and recall scores less than 50.

Any help would be appreciated.

Thank you.

  • $\begingroup$ If you think that there is a problem to your model by the imbalanceness of the classes, have you considered using a resampling methods such SMOTE for oversappling? $\endgroup$
    – JoPapou13
    Nov 7 '18 at 19:45
  • $\begingroup$ Yes, I have used smote method to oversample and then computed the above results. $\endgroup$ Nov 7 '18 at 20:00

This answer explains how micro and macro are different and which one you should use.

  • 1
    $\begingroup$ There's also weighted mode for precision, recall and f1. $\endgroup$ Dec 3 '19 at 12:16

For imbalanced datasets you can employ F1 score. It considers both rare and common classes. You can take a look at this article if you are not familiar with that.


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.