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

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)
主站蜘蛛池模板: 长海县| 勃利县| 淮阳县| 洛浦县| 买车| 巴林右旗| 盖州市| 七台河市| 泾源县| 丘北县| 九台市| 通道| 三门县| 保亭| 宜州市| 兴安盟| 崇阳县| 衡山县| 柞水县| 池州市| 盐亭县| 旅游| 娄底市| 栾城县| 曲阜市| 玉树县| 富顺县| 彭山县| 台江县| 堆龙德庆县| 贞丰县| 泰和县| 房产| 邓州市| 永宁县| 灌南县| 闵行区| 林甸县| 监利县| 鄂伦春自治旗| 资源县|