msproper commited on
Commit
650ab6c
·
1 Parent(s): 1eff2a2

ahahahaha

Browse files
Files changed (1) hide show
  1. TeachMyMother.ipynb +29 -0
TeachMyMother.ipynb ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import matplotlib as plt
2
+ import tensorflow as tf
3
+ import math
4
+ from tensorflow.keras.datasets import fashion_mnist
5
+ from tensorflow.keras.models import Sequential
6
+ from tensorflow.keras.layers import Dense, Flatten
7
+
8
+ # Загрузка данных Fashion-MNIST
9
+ (x_train, y_train), (x_test, y_test) = fashion_mnist.load_data()
10
+
11
+ # Нормализация данных
12
+ x_train = x_train / 255.0
13
+ x_test = x_test / 255.0
14
+
15
+ # Создание модели нейронной сети
16
+ model = Sequential()
17
+ model.add(Flatten(input_shape=(28, 28))) # Преобразование двумерных изображений в одномерный вектор
18
+ model.add(Dense(128, activation='relu'))
19
+ model.add(Dense(10, activation='softmax')) # 10 классов для классификации
20
+
21
+ # Компиляция модели
22
+ model.compile(optimizer='adam', loss='sparse_categorical_crossentropy', metrics=['accuracy'])
23
+
24
+ # Обучение модели
25
+ model.fit(x_train, y_train, epochs=10, batch_size=32, validation_data=(x_test, y_test))
26
+
27
+ # Оценка точности модели на тестовых данных
28
+ test_loss, test_accuracy = model.evaluate(x_test, y_test)
29
+ print("Точность на тестовых данных:", test_accuracy)