官术网_书友最值得收藏!

Flattened data

We will use flattened data in this example, or a representation of MNIST images in one dimension rather than two can also be used. Thus, each 28 x 28 pixels number image will be represented as a 784 pixel 1 dimensional array.

By flattening the data, information about the 2D structure of the image is thrown; however, our data is simplified. With the help of this, all our training data can be contained in one array of shape (60,000, 784), wherein the first dimension represents the number of training images and the second depicts the number of pixels in each image. This kind of data is easy to analyze using a simple neural network, as follows:

# Retrieving the training and test data
(X_train, y_train), (X_test, y_test) = mnist.load_data()


print('X_train shape:', X_train.shape)
print('X_test shape: ', X_test.shape)
print('y_train shape:',y_train.shape)
print('y_test shape: ', y_test.shape)
主站蜘蛛池模板: 百色市| 宁夏| 翁源县| 通州市| 海城市| 喀喇| 连城县| 于都县| 顺昌县| 禹州市| 赤水市| 乌鲁木齐县| 防城港市| 台中市| 西盟| 敖汉旗| 涿州市| 龙岩市| 太仓市| 容城县| 云南省| 鄯善县| 阳曲县| 克拉玛依市| 和平区| 麦盖提县| 涿鹿县| 静安区| 承德市| 安西县| 松桃| 木兰县| 德化县| 塔河县| 斗六市| 淳安县| 焦作市| 故城县| 三门县| 迁安市| 高唐县|