Answers for "keras ensure equal class representation during traingin"

1

keras ensure equal class representation during traingin

from sklearn.utils import class_weight
class_weights = class_weight.compute_class_weight('balanced',
                                                 np.unique(y_train),
                                                 y_train)
model.fit(X_train, y_train, class_weight=class_weights)
Posted by: Guest on May-18-2021

Python Answers by Framework

Browse Popular Code Answers by Language