Como poderia ser sanado esse erro?
import numpy as np
def plot_boundary(X, y, model):
x_min, x_max = X[:,0].min()-0.1, X[:,0].max()+0.1
y_min, y_max = X[:,0].min()-0.1, X[:,0].max()+0.1
spacing = min(x_max - x_min, y_max - y_min) / 100
XX, YY = np.meshgrid(np.arange(x_min, x_max, spacing),
np.arange(y_min, y_max, spacing))
data = np.hstack((XX.ravel().reshape(-1,1),
YY.ravel().reshape(-1,1)))
# for binary problems
# db_prob = model(Variable(torch.Tensor(data)).cuda())
# clf = np.where(db_prob.cpu().data < 0.5, 0, 1)
# for multi-class problems
db_prob = model(torch.Tensor(data).to(device))
clf = np.argmax(db_prob.cpu().data.numpy(), axis=-1)
Z = clf.reshape(XX.shape)
plt.contourf(XX, YY, Z, cmap = plt.cm.brg, alpha=0.5)
plt.scatter(X[:,0], X[:,1], c=y, edgecolors = 'k', s=25, cmap = plt.cm.brg)
NameError Traceback (most recent call last)
<ipython-input-51-ba5bf6f5bc78> in <module>
19
20 # for multi-class problems
---> 21 db_prob = model(torch.Tensor(data).to(device))
22 clf = np.argmax(db_prob.cpu().data.numpy(), axis=-1)
23
NameError: name 'model' is not defined