【问题标题】:Tensorflow, imblearn import issues:TensorFlow、imblearn 导入问题:
【发布时间】:2020-10-28 08:51:59
【问题描述】:

这个错误到底是什么,我该如何解决?
运行最新版本的 TensorFlow 和 Keras


TypeError                                 Traceback (most recent call last)
<ipython-input-2-ffa5ea4a7bf5> in <module>
     26 
     27 import imblearn
---> 28 from imblearn.keras import balanced_batch_generator as bbg
     29 from imblearn.over_sampling import RandomOverSampler as ros
     30 import matplotlib.pyplot as plt

~\anaconda3\lib\site-packages\imblearn\keras\__init__.py in <module>
      2 in keras."""
      3 
----> 4 from ._generator import BalancedBatchGenerator
      5 from ._generator import balanced_batch_generator
      6 

~\anaconda3\lib\site-packages\imblearn\keras\_generator.py in <module>
     55 
     56 
---> 57 class BalancedBatchGenerator(*ParentClass):
     58     """Create balanced batches when training a keras model.
     59 

TypeError: duplicate base class Sequence

【问题讨论】:

  • 你的导入语句是什么样的?

标签: tensorflow keras imblearn


【解决方案1】:

我遇到了同样的问题,当我看到这个问题没有解决时,我随后在 Imbalanced Learn 的 GitHub 页面上发帖。以为我会回来给你 here的答案。

TL; link 的博士:

  • “问题的根源在于您单独安装了 keras。”
  • “因此,作为一种解决方法,卸载 keras 模块本身并直接从 tensorflow 导入将解决您的问题。”

【讨论】:

    猜你喜欢
    • 2019-03-25
    • 2019-04-16
    • 2017-02-21
    • 1970-01-01
    • 2018-10-03
    • 2020-03-20
    • 2021-04-28
    • 2020-11-05
    • 1970-01-01
    相关资源
    最近更新 更多