I have very simple input: Points, and I am trying to classify whether they are in some region or not. So my training data is of the shape (1000000, 2)
, which is
Your labels are of the wrong shape. See the documentation:
When using the
sparse_categorical_crossentropy
loss, your targets should be integer targets. If you have categorical targets, you should usecategorical_crossentropy
So you need to convert your labels to integers:
train_labels = np.argmax(train_labels, axis=1)
Per your description of the problem, it seems to be a binary classification task (i.e. inside-region vs. out-of-region). Therefore, you can do the followings:
'sigmoid'
as the activation function of last layer.'binary_crossentropy'
as the loss function.You also need to map your current labels, i.e. [1,0]
and [0,1]
, to 0s and 1s.