[Keras] AttributeError: 'Sequential' object has no attribute 'predict_classes'

강승구·2022년 12월 29일
0

원인

tensorflow 버전 2.6이후로 predict_classes가 없기 때문에 발생하는 오류이다.


해결법

predict_classes 대신 다음 코드로 대체하면 된다.

//오류 발생 코드
predicted = model.predict_classes(y_test, verbose=0)

//오류 해결
y_prob = model.predict(y_test, verbose=0) 
predicted = y_prob.argmax(axis=-1)
profile
강승구

0개의 댓글