Home>

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']).

ValueError: Unknown loss function: categorical_crossentoropy
Corresponding source code
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))
Supplementary information (FW/tool version, etc.)

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.