Nov-28-2020, 08:41 PM
(Nov-28-2020, 06:43 PM)bowlofred Wrote: It looks like you expectplt
to be an object that has aplot()
method. But instead it's just a list. Possibly you are create plt incorrectly. Without seeing the code, we cannot guess.
model = Sequential() model.add(LSTM(lstm_units, input_shape=(num_timestamps,1))) model.add(Dense(dense_units, activation='relu')) model.add(Dense(dense_units, activation='relu')) model.add(Dense(dense_units, activation='relu')) model.add(Dense(num_classes, activation='softmax')) model.compile(loss=tf.keras.losses.categorical_crossentropy, optimizer='adam', metrics=['accuracy']) print('Model compiled successfully') # --- Fit model history=model.fit(train_X, train_Y ,epochs=epochs, batch_size=batch_size, verbose=1, validation_split=0.2) print('Model fit successfully') .... accuracy = model.evaluate(test_X, test_Y, batch_size=batch_size, verbose=1) print('Evaluation of the model completed') print(accuracy[1]*100, 'percent') plt.plot(history.history['loss']) plt.plot(history.history['val_loss']) plt.title('model loss') plt.ylabel('loss') plt.xlabel('epoch') plt.legend(['train', 'test'], loc='upper left') plt.show() plt.plot(history.history['accuracy']) plt.plot(history.history['val_accuracy']) plt.title('model accuracy') plt.ylabel('accuracy') plt.xlabel('epoch') plt.legend(['train', 'test'], loc='upper left') plt.show()