语法错误尝试调用sklearn_genetic

发布于 2025-02-07 15:02:35 字数 1164 浏览 2 评论 0原文

安装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的新手,您能帮助我定义这是什么错误?

After Installing sklearn-genetic-opt
I tried to call it with this code

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

But I got this Syntax Error, and I don't have an idea what is that

  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

I am new to Python, can you help me define what error is this?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文