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

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)
主站蜘蛛池模板: 安西县| 宜良县| 东辽县| 平湖市| 精河县| 西峡县| 平定县| 翁源县| 浦城县| 新津县| 探索| 舒城县| 高州市| 五家渠市| 麻城市| 大足县| 曲沃县| 南昌市| 来凤县| 宁津县| 潢川县| 方城县| 淮滨县| 宣城市| 永济市| 平谷区| 广平县| 错那县| 永顺县| 宜兴市| 靖安县| 宁武县| 谢通门县| 韶山市| 桃园县| 龙游县| 新竹县| 阳东县| 台东市| 齐齐哈尔市| 肃南|