1from sklearn.utils import class_weight
2class_weights = class_weight.compute_class_weight('balanced',
3 np.unique(y_train),
4 y_train)
5model.fit(X_train, y_train, class_weight=class_weights)