Monday, September 17, 2018

Keras: Error while training the model

While running a Keras model have encountered an error like the below
Solution: 
Keras expects y-data in (N, 17) shape, not (N,) as have probably provided, that's why it raises an error.
class_index_one_hot = keras.utils.to_categorical(class_index, 17)
Output Ex: class_index_one_hot: [0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 1.]
y_train shape: (911, 17)
y_test shape: (449, 17)
Reference:


No comments: