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

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)
主站蜘蛛池模板: 崇礼县| 丰原市| 郎溪县| 阜阳市| 高碑店市| 永平县| 邯郸市| 桂林市| 东辽县| 北票市| 当雄县| 绥芬河市| 和林格尔县| 肃南| 从江县| 达孜县| 和田市| 潞城市| 桐柏县| 闽清县| 英吉沙县| 济阳县| 灌阳县| 洪雅县| 溧水县| 清新县| 尚义县| 伽师县| 南开区| 祥云县| 万山特区| 凭祥市| 双峰县| 大冶市| 常宁市| 淮北市| 台前县| 新绛县| 武宣县| 康平县| 屏边|