class_weight from sklearn.ensemble import RandomForestClassifier
model = RandomForestClassifier(class_weight="balanced") model.fit(X_train, y_train)