qq_41543242
qq_41543242
采纳率100%
2019-03-18 10:12 阅读 648

为什么我用python运行一个可视化MINST数据的文件,系统总是提示‘X_train is not defined’?

import matplotlib.pyplot as plt

fig, ax = plt.subplots(
nrows=2,
ncols=5,
sharex=True,
sharey=True, )

ax = ax.flatten()
for i in range(10):
img = X_train[y_train == i][0].reshape(28, 28)
ax[i].imshow(img, cmap='Greys', interpolation='nearest')

ax[0].set_xticks([])
ax[0].set_yticks([])
plt.tight_layout()
plt.show()

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享

相关推荐