PyML 具有绘制决策面的功能。
首先,您需要告诉 PyML 使用哪些数据。在这里,我将 sparsevectordata 与我的特征向量一起使用。这是我用来训练我的 SVM 的那个。
demo2d.setData(training_vector)
然后你需要告诉它你想使用哪个分类器。我给它一个训练有素的 SVM。
demo2d.decisionSurface(best_svm, fileName = "dec.pdf")
但是,我收到此错误消息:
Traceback (most recent call last):
**deleted by The Unfun Cat**
demo2d.decisionSurface(best_svm, fileName = "dec.pdf")
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/PyML/demo/demo2d.py", line 140, in decisionSurface
results = classifier.test(gridData)
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/PyML/evaluators/assess.py", line 45, in test
classifier.verifyData(data)
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/PyML/classifiers/baseClassifiers.py", line 55, in verifyData
if len(misc.intersect(self.featureID, data.featureID)) != len(self.featureID) :
AttributeError: 'SVM' object has no attribute 'featureID'