When I ran the source code 2.7 from the book "Machine learning with python and examples", I got the following error:
Judging from the content of the error, I don't think it's an error in the code I wrote, but where is it stuck?
The third line, dnn.compile (optimizer ='adam', loss ='categorical_crossentropy', metrics = ['accuracy']) does not cause an error,
An error occurs on the 10th line mlp.compile (loss ='categorical_crossentoropy', optimizer ='adam', metrics = ['accuracy']).
Corresponding source code
ValueError: Unknown loss function: categorical_crossentoropy
Supplementary information (FW/tool version, etc.)
y = Dense (n_out, activation ='softmax', name ='predictions') (h) dnn = Model (inputs = ae.inputs, outputs = y) dnn.compile (optimizer ='adam', loss ='categorical_crossentropy', metrics = ['accuracy']) records_dnn = dnn.fit (X_trn, y_trn, epochs = 50, batch_size = 200, shuffle = True, validation_data = (X_tst, y_tst)) mlp = Sequential () mlp.add (Dense (500, input_dim = n_dim, activation ='sigmoid')) mlp.add (Dense (n_out, activation ='softmax')) mlp.compile (loss ='categorical_crossentoropy', optimizer ='adam', metrics = ['accuracy']) records_mlp = mlp.fit (X_trn, y_trn, epochs = 100, batch_size = 200, validation_data = (X_tst, y_tst))
I copied the part of the code that seems to be long and relevant. If i have any missing information, please comment.
I'm running on Anaconda.
Answer # 1
- python - resolve program error "keyerror: 0"
- resolve python error code
- python - how to resolve attribute error
- python - idle cannot resolve the "rootgeometry" error
- python - tuple error does not resolve
- i want to resolve a syntax error in a python while statement
- python - i don't know how to resolve this error in sqlalchemy
- python - twitterapi i want to resolve errors when acquiring follower information
- python - i get the error "no attribute'connect'" when connecting a signal to a slot
- python - error when scraping with selenium and firefox
- [python] graphviz output format error
- python - i get an error when connecting to a voice channel with discordpy
- python 3x - best estimator: i get an error with no syntax, so please tell me what to do
- python - an error has occurred in yolo v3
- [python] i don't know how to solve the error
- python error code how to deal with
- python - i get an error when i type pip3 install scikit-learn
- python - i want to resolve typeerror: expected ptr for argument'% s'in cv2countnonzero
- ruby - i want to resolve a routing error in the create action
- python : About the size of y_pred, y_true in Keras
- python : Working with a small amount of data for binary classification in neural networks
- python : RESOURCEEXHAUSTEDERRORRORR ERROR During neural network training
- python : Valueerror error: Invalid Literal for int () with Base 10 When running Estimator.Train string (input_fn= train_input_fn
- python : 95% Accuracy Predicts Wrong Class (Multiclass Classification Kaggle GTSRB -German Traffic Sign Recognition Benchmark)
- python : TensorFlow Cudart64_101.dll Not Found
- python : How to make the neural set classify the text?
- Using Weights in FIT () with Python Keras-RL
- python : Permissionerror: [errno 13] permission denied