3
votes

I want to use a logistic loss cost function for my deep learning model to solve a binary classification problem. I am using keras to build the model. However, keras doesn't have any pre-defined logistic loss function.

While reading about loss functions I came across confusing statements about cross entropy loss and logistic loss. In this wikipedia article, there is a separate section for logistic loss and cross entropy loss.

However in this wikipedia article, its mentioned that:

The logistic loss is sometimes called cross-entropy loss.

Additionally, this sklearn page starts with:

Log loss, aka logistic loss or cross-entropy loss.

Any help would be appreciated.

1
The question might be more suitable for datascience.stackexchange.comEulenfuchswiesel

1 Answers

1
votes

In keras use binary_crossentropy for classification problem with 2 class. use categorical_crossentropy for more than 2 classes.

Both are same only.If tensorflow is used as backend for keras then it uses below mentioned function to evaluate binary_crossentropy.

tf.nn.sigmoid_cross_entropy_with_logits(labels=target,
                                                   logits=output)

In documentation of this function below is mentions:

For brevity, let x = logits, z = labels. The logistic loss is

z * -log(sigmoid(x)) + (1 - z) * -log(1 - sigmoid(x))