小编Jac*_*ott的帖子

NameError:未定义名称"树"

嘿,我是Python的新手,我正在尝试按照教程,但我收到此错误:

NameError:未定义名称"树".

显然,该计划的目的是根据特征的输入确定水果是苹果还是橙子.我在Win 10上使用Python 3.6和spyder编辑器.我确信这很简单,感谢您的帮助!

# -*- coding: utf-8 -*-
"""
Spyder Editor

This is a temporary script file.
"""

# features = [[140, "smooth"], [130, "smooth"], [150, "bumpy"], [170, "bumpy"]]
# labels = ["apple", "apple", "orange", "orange"]
features = [[140, 1], [130, 1], [150, 0], [170, 0]]
labels = [0, 0, 1, 1]
# We build a "Decision Tree" yes/no -> yes/no
# clf means classifier
clf = tree.DecisionTreeClassifier()
# Think of "fit" as "find patters in data"
clf …
Run Code Online (Sandbox Code Playgroud)

python python-3.x spyder scikit-learn

0
推荐指数
1
解决办法
6996
查看次数

标签 统计

python ×1

python-3.x ×1

scikit-learn ×1

spyder ×1