Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from tensorflow import keras
- import matplotlib.pyplot as plt
- import numpy as np
- features_train = np.load('/datasets/fashion_mnist/train_features.npy')
- target_train = np.load('/datasets/fashion_mnist/train_target.npy')
- features_test = np.load('/datasets/fashion_mnist/test_features.npy')
- target_test = np.load('/datasets/fashion_mnist/test_target.npy')
- features_train = features_train.reshape(features_train.shape[0], 28 * 28)
- features_test = features_test.reshape(features_test.shape[0], 28 * 28)
- print("Обучающая:", features_train.shape)
- print("Тестовая:", features_test.shape)
- model = keras.models.Sequential()
- model.add(keras.layers.Dense(units = 1, input_dim = features_train.shape[1], activation = 'softmax'))
- model.compile(loss='sparse_categorical_crossentropy', optimizer = 'sgd')
- model.fit(features_train, target_train, epochs=1, verbose=2,
- validation_data=(features_test, target_test))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement