我试图了解并使用this code from the scikit learn site:
我已将X更改为
X = [[ 170, 70 ], [ 180, 80 ], [ 190, 90 ], [ 200, 100], [ 172, 80 ], [ 182, 72 ], [ 185, 95 ], [ 184, 74 ], [ 184, 80 ], [ 177, 67 ], [ 177, 77 ], [ 177, 87 ],
[ 190, 85 ], [ 190, 86 ], [ 190, 97 ], [ 190, 82 ], [ 190, 84 ], [ 195, 85 ], [ 185, 92 ], [ 185, 77 ], [ 183, 87 ], [ 183, 77 ], [ 183, 78 ], [ 182, 88 ],
[ 177, 78 ], [ 177, 82 ], [ 176, 70 ], [ 172, 65 ], [ 170, 62 ], [ 170, 68 ], [ 173, 65 ], [ 173, 64 ], [ 168, 71 ], [ 169, 62 ], [ 174, 80 ], [ 173, 65 ],
[ 180, 100], [ 180, 60 ], [ 170, 90 ], [ 170, 55 ], [ 180, 68 ], [ 175, 92 ], [ 168, 100], [ 177, 110], [ 180, 110], [ 186, 65 ], [ 186, 145], [ 190, 120],
[ 175, 55 ], [ 182, 65 ], [ 195, 70 ], [ 173, 90 ], [ 175, 50 ], [ 182, 130], [ 183, 65 ], [ 150, 82 ], [ 155, 80 ], [ 200, 70 ], [ 185, 110], [ 176, 100]]
这是作为训练数据集的身高和体重。
我也改变了
y = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
这是可以接受的 - 不可接受,我的两个班级。
如何测试[140,85]这样的新案例,看它是1还是0?
Z = clf.predict(np.c_[xx.ravel(), yy.ravel()])
该示例中的使用与训练数据相同的数据,并且它的计算基于训练数据集的最小值,最大值和步长,这是令人困惑的。请帮忙。