修正prediction=model.predict_classes(x_test_normalize)
原程式碼:prediction=model.predict_classes(x_test_normalize)
出現錯誤:AttributeError Traceback (most recent call last)
Cell In[62], line 1 ----> 1 prediction=model.predict_classes(x_test_normalize) AttributeError: 'Sequential' object has no attribute 'predict_classes'
修正成這樣就好了
import numpy as np
# Assuming you have defined and compiled your Keras model
# model = Sequential() # Your model definition
# model.compile(...) # Your model compilation
# Assuming you have normalized test data `x_test_normalize`
# Use the predict method to get probability scores
probabilities = model.predict(x_test_normalize)
# Use np.argmax to find the predicted class indices
predicted_classes = np.argmax(probabilities, axis=1)
评论
发表评论