1
$\begingroup$

I want to train a CNN with Early Stopping (Keras). The data set is imbalanced, so I have set class_weights to 'balanced' like follows:

class_weights=class_weight.comput_class_weight('balanced', np.unique(y_train),y_train)

I would like also use Early Stopping, and here is the problem. Which metric for monitor should I use? Because I have still balanced the data set with the class weights, shouldn't it be ok when using val_loss?

Hoping for hints and thank you in advance

$\endgroup$
0
$\begingroup$

Early stopping is not directly affected by imbalanced data.

Also comput_class_weight effects the training, not the evaluation.

As far as picking a metric for evaluating imbalanced data, it depends on the specific problem. The most common choices are F-score, precision, and recall. It appears that you are using scikit-learn which offers a weighted option, finding average weighted by class support.

| improve this answer | |
$\endgroup$

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.