y_train = y_train.reshape(-1,)
y_train[:5]
y_test = y_test.reshape(-1,)
nwclasses= classes
nwclasses = ["airplane","automobile","bird","cat","deer","dog","frog","horse","ship","truck"]
def plot_sample(X, y, index):
plt.figure(figsize = (15,2))
plt.imshow(X[index])
plt.xlabel(classes[y[index]])
plot_sample(X_train, y_train, 1)
**TypeError Traceback(最近一次调用最后一次) 在 ----> 1 plot_sample(X_train, y_train, 1)
<ipython-input-34-4fb71385cd26> in plot_sample(X, y, index)
1 def plot_sample(X, y, index):
----> 2 plt.figure(figsize = (15,2))
3 plt.imshow(X[index])
4 plt.xlabel(classes[y[index]])
TypeError: 'module' object is not callable**
答案 0 :(得分:0)
figure
是 matplotlib 中的一个模块,我们用 figure.Figure
类代替:
import matplotlib
matplotlib.figure.Figure(figsize = (15,2))