Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
'list' object not callable
#3
(Nov-28-2020, 06:43 PM)bowlofred Wrote: It looks like you expect plt to be an object that has a plot() 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()
Reply


Messages In This Thread
'list' object not callable - by sidra - Nov-28-2020, 03:06 PM
RE: 'list' object not callable - by bowlofred - Nov-28-2020, 06:43 PM
RE: 'list' object not callable - by sidra - Nov-28-2020, 08:41 PM
RE: 'list' object not callable - by bowlofred - Nov-28-2020, 09:46 PM
RE: 'list' object not callable - by sidra - Nov-29-2020, 11:50 AM
RE: 'list' object not callable - by bowlofred - Nov-29-2020, 04:56 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  error in class: TypeError: 'str' object is not callable akbarza 2 606 Dec-30-2023, 04:35 PM
Last Post: deanhystad
  TypeError: 'NoneType' object is not callable akbarza 4 1,147 Aug-24-2023, 05:14 PM
Last Post: snippsat
  [NEW CODER] TypeError: Object is not callable iwantyoursec 5 1,520 Aug-23-2023, 06:21 PM
Last Post: deanhystad
  Need help with 'str' object is not callable error. Fare 4 911 Jul-23-2023, 02:25 PM
Last Post: Fare
  TypeError: 'float' object is not callable #1 isdito2001 1 1,130 Jan-21-2023, 12:43 AM
Last Post: Yoriz
  'SSHClient' object is not callable 3lnyn0 1 1,233 Dec-15-2022, 03:40 AM
Last Post: deanhystad
  TypeError: 'float' object is not callable TimofeyKolpakov 3 1,565 Dec-04-2022, 04:58 PM
Last Post: TimofeyKolpakov
  add object and name in list 3lnyn0 4 1,337 Nov-24-2022, 07:33 PM
Last Post: buran
  API Post issue "TypeError: 'str' object is not callable" makeeley 2 2,005 Oct-30-2022, 12:53 PM
Last Post: makeeley
  Merge htm files with shutil library (TypeError: 'module' object is not callable) Melcu54 5 1,707 Aug-28-2022, 07:11 AM
Last Post: Melcu54

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020