Search code examples
pythontensorflowkerasimbalanced-data

how to import "balanced_batch_generator"?


I want to import " balanced_batch_generator" by below code. but it gives an error as below. I was wonder if someone helps me

Error: AttributeError: module 'keras.utils' has no attribute 'Sequence'

from imblearn.keras import balanced_batch_generator

Solution

  • Since Keras is now integrated into 2.x versions of Tensorflow, you might try this:

    Replace

    from imblearn.keras import balanced_batch_generator
    

    with

    from imblearn.tensorflow import balanced_batch_generator