跟着老师打的,可是为什么会报错NameError: name 'X' is not defined?
def plot_decision_regions(X, y, classifier, resolution=0.02): marker = {'s','x','o','v'} colors = {'red','blue','lightgreen','gray','cyan'} cmap = ListedColormap(colors[:len(numpy.unique(y))]) x1_min,x1_max = X[:,0].min() - 1, X[:,0].max() x2_min,x2_max = X[:,1].min() - 1, X[:,1].max() print(x1_min,x1_max) print(x2_min,x2_max) plot_decision_regions(X, y, ppn, resolution=0.02)
Traceback (most recent call last):
File "E:/python/pythonproject/robot_learning/test.py", line 100, in <module>
plot_decision_regions(X, y, ppn, resolution=0.02)
NameError: name 'X' is not defined