Error in keras sparse_categorical_crossentropy loss function
stackoverflow.com › questions › 61726869if you have 1D integer encoded target you can use sparse_categorical_crossentropy as loss function X = np.random.randint(0,10, (1000,100)) y = np.random.randint(0,3, 1000) model = Sequential([ Dense(128, input_dim = 100), Dense(3, activation='softmax'), ]) model.summary() model.compile(loss='sparse_categorical_crossentropy',optimizer='adam',metrics=['accuracy']) history = model.fit(X, y, epochs=3)
Keras - Categorical Cross Entropy Loss Function - Data ...
28.10.2020 · categorical_crossentropy: Used as a loss function for multi-class classification model where there are two or more output labels. The output label is assigned one-hot category encoding value in form of 0s and 1. The output …