-1

I have the following neural network model.

nn_classifier = Sequential()
nn_classifier.add(Dense(output_dim = 16 ,activation='relu',input_dim = 13))
nn_classifier.add(Dense(output_dim = 16,activation='relu'))
nn_classifier.add(Dense(output_dim = 1, activation = 'sigmoid'))

nn_classifier.compile(optimizer = 'sgd', loss = 'binary_crossentropy', metrics=[tf.keras.metrics.BinaryAccuracy(threshold=0.5)])
model=nn_classifier.fit(X_train, Y_train ,validation_split=0.33, batch_size = 10, nb_epoch = 100)
Y_pred = nn_classifier.predict(X_test)

As I have used the sigmoid function in my output layer, I was expecting the predicted values (Y_pred) are either 0 or 1. But I get some decimal values. Is my understanding wrong?

user6771624
  • 55
  • 2
  • 8

1 Answers1

0

Sigmoid always gives a value in [0,1] you need to round the value that means fix a threshold if it is higher than threshold then 1 else 0.