Received a label value of 1 which is outside the valid range of [0, 1) - Python, Keras

后端 未结 5 1363
臣服心动
臣服心动 2021-02-01 14:25

I am working on a simple cnn classifier using keras with tensorflow background.

def cnnKeras(training_data, training_labels, test_data, test_labels, n_dim):
  pr         


        
5条回答
  •  广开言路
    2021-02-01 14:58

    Cray and Shaili's answer was correct! I had a range of outcomes from 1 to 6, and the line:

    tf.keras.layers.Dense(6, activation = 'softmax') 
    

    Produced that error message, saying that things were outside of the range [0,6). I had thought that it was a labels problem (were all values present in both the training and validation label sets?), and was flogging them.

    )

提交回复
热议问题