Can not squeeze dim[1], expected a dimension of 1, got 2

后端 未结 2 1519
情话喂你
情话喂你 2020-12-21 03:34

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

2条回答
  •  时光说笑
    2020-12-21 04:11

    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:

    1. Use 'sigmoid' as the activation function of last layer.
    2. Use one unit (instead of 2) in the last layer.
    3. Use '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.

提交回复
热议问题