我正在尝试为UCI井字游戏数据集(https://archive.ics.uci.edu/ml/datasets/Tic-Tac-Toe+Endgame)建立分类算法,但遇到了一些问题
Model = Sequential()
Model.add(Dense(9))
Model.add(Dense(64))
Model.add(Dense(64))
Model.add(Dense(1, activation="softmax"))
Model.compile(loss = "binary_crossentropy", optimizer = "Adam", metrics = ["accuracy"])
Model.fit(X_Train, Y_Train, batch_size = BATCH_SIZE, epochs = EPOCHS, validation_data = (X_Val, Y_Val))
我收到了我所有纪元的消息
Epoch 100/100
861/861 [==============================] - 0s 40us/step - loss: 5.3782 - accuracy: 0.6492 -
val_loss: 4.7916 - val_accuracy: 0.6875
有人知道解决此问题的方法
答案 0 :(得分:1)
您不能对一个神经元使用softmax,如果其二进制分类,则应在输出层使用sigmoid
激活:
Model.add(Dense(1, activation="sigmoid"))