【问题标题】:Syntax Error when try to call sklearn_genetic尝试调用 sklearn_genetic 时出现语法错误
【发布时间】:2022-06-15 18:57:35
【问题描述】:

安装 sklearn-genetic-opt 后 我试着用这段代码调用它

from sklearn_genetic import GASearchCV
from sklearn_genetic.space import Continuous
from sklearn_genetic.plots import plot_fitness_evolution, plot_search_space

但是我得到了这个语法错误,我不知道那是什么

  File c:\Users\ASUS\AppData\Local\Programs\Python\Python310\lib\site-packages\IPython\core\interactiveshell.py:3398 in run_code
    exec(code_obj, self.user_global_ns, self.user_ns)

  Input In [9] in <cell line: 26>
    from sklearn_genetic import GASearchCV

  File c:\Users\ASUS\AppData\Local\Programs\Python\Python310\lib\site-packages\sklearn_genetic\__init__.py:1 in <module>
    from .genetic_search import GASearchCV, GAFeatureSelectionCV

  File c:\Users\ASUS\AppData\Local\Programs\Python\Python310\lib\site-packages\sklearn_genetic\genetic_search.py:6 in <module>
    from deap import base, creator, tools

  File c:\Users\ASUS\AppData\Local\Programs\Python\Python310\lib\site-packages\deap\base.py:192
    raise TypeError, ("Both weights and assigned values must be a "
                   ^
SyntaxError: invalid syntax

我是 Python 新手,你能帮我定义一下这是什么错误吗?

【问题讨论】:

  • 由于某种原因,您似乎拥有deap 的 Python 2 版本。

标签: python scikit-learn jupyter-notebook genetic-algorithm


猜你喜欢
  • 2012-03-21
  • 1970-01-01
  • 1970-01-01
  • 2019-08-10
  • 2013-11-15
  • 2012-08-03
  • 2021-11-03
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多