. Neyon tarmoqni o’qitish paramertlarini(o’qish qadami-lr, o’qitishlar soni-epoch) tanlang.
optimizer = Adam(learning_rate=0.001)
model.compile(optimizer, loss='categorical_crossentropy', metrics=['accuracy'])
history = model.fit(train_x, train_y, verbose=2, batch_size=5, epochs=200)
Neyron tarmoqning o’qitish natijalarini garfik tarvirlang.
Grafikda tasvirlab ko’ramiz.
plt.figure(figsize=(14,2))
plt.subplot(131)
plt.plot(history.history['accuracy'])
plt.title('Model accuracy')
plt.ylabel('Accuracy')
plt.xlabel('Epoch')
plt.grid()
plt.subplot(132)
plt.plot(history.history['loss'])
plt.title('Model loss')
plt.ylabel('Loss')
plt.xlabel('Epoch')
plt.grid()
plt.show()
Model aniqligini hisoblang(o’rgatuvchi tanalama uchun).
Modelni test to’plam bilan testlang. Modelini test to’plamdagi aniqligini hisoblang.
Do'stlaringiz bilan baham: |