MNISTの行列表示
python==3.7.9
Keras==2.2.4
tensorflow==1.13.1
mnistを画像表示する
import urllib.request
import tensorflow as tf
import matplotlib.pyplot as plt
import numpy as np
#prox = urllib.request.build_opener()
#urllib.request.install_opener(prox)
from keras.datasets import mnist
(x_train, y_train), (x_test, y_test) = mnist.load_data()
plt.imshow(x_train[0])
import urllib.request
import tensorflow as tf
import matplotlib.pyplot as plt
import numpy as np
#prox = urllib.request.build_opener()
#urllib.request.install_opener(prox)
from keras.datasets import mnist
(x_train, y_train), (x_test, y_test) = mnist.load_data()
plt.imshow(x_train[0])
行列で表示
通常のprintではmatrix形式が省略されてつぶれてしまうが
linewidthに一行に表示する文字数を指定することで見やすくする
np.set_printoptions(linewidth = 115, precision = 1)
print(x_train[0])
スペースを含み115文字で表示できる。
以上
Author And Source
この問題について(MNISTの行列表示), 我々は、より多くの情報をここで見つけました https://qiita.com/Ringa_hyj/items/b43654d14daedaecf12e著者帰属:元の著者の情報は、元のURLに含まれています。著作権は原作者に属する。
Content is automatically searched and collected through network algorithms . If there is a violation . Please contact us . We will adjust (correct author information ,or delete content ) as soon as possible .