Ensuring class balanced batches while training keras models is possible using fit_generator method. I used imblearn.keras.BalancedBatchGenerator for that and it works fine!

But i wanted to do that with GridSearchCV to fine-tune my model, so i created an inherited class KerasBatchClassifier(KerasClassifier) as a Keras Wrapper for the Scikit-Learn API. (Inspired by this StackOverflow question)

Ensuring class balanced batches to fit the model is working, but i haven't figured out how to do it with validation data ! Any ideas to do that ?


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.