Using the sample_weight parameter in the RandomForestClassifier along with the
balance_weights method from the preprocessing module to generate the sample
weights might work as well.
You can check this link for a previous related discussion.
Hey!
One simple solution that often works wonders is to set the class_weight
parameter of a classifier (if available) to 'auto' [1].
If you have enough data, it often also makes sense to balance the data
beforehand.
[1] http://scikit-learn.org/dev/modules/svm.html#unbalanced-problems
Am