在學習莫煩教程中keras教程時,報錯:TypeError: to_categorical() got an unexpected keyword argument 'nb_classes',代碼如下
X_train = X_train.reshape(X_train.shape[0],-1) / 255 #normalize X_test = X_test.reshape(X_test.shape[0],-1) / 255 #normalize y_train = np_utils.to_categorical(y_train, nb_classes=10) y_test = np_utils.to_categorical(y_test, nb_classes=10)
錯誤原因:keras版本問題,將nb_classes改為num_classes
參考keras文檔:http://keras-cn.readthedocs.io/en/latest/utils/
