Why there is two output in Titanic case in tflearn quickstart?

0

I am stuck in the tflearn quickstart guide.

I've tried tit and it works perfectly with accuracy around 78%, but the problem is I don't understand why the "labels" consist of two "survived" columns that are the opposite of each other. I've trained the same data but used only single "survived" column in the labels or the output, but with the same code I just get around 36% with 0 loss or even NaN loss.

So why is there two columns output/labels? And why can't I use only a single column?

Zahi Azmi

Posted 2017-12-24T09:41:33.190

Reputation: 49

The output is one, the classes are 2 and hence when converted to categorical column, have two columns – enterML – 2017-12-24T12:28:24.097

@Nain so if i have 3 output, the classes will be 6? – Zahi Azmi – 2017-12-25T09:12:29.847

Nope, it would be three only – enterML – 2017-12-25T14:16:40.617

Answers

1

Since you have only one binary target to predict (survived vs not survived) you can use only one output (that provide the probability of surviving). The problem with this approach is that you can not longer use softmax activation, since it will always be 1. Remember that softmax activation has the form $$g(x_k)=\frac{e^{x_k}}{\sum_{i=1}^n e^{x_i}}$$ Since you have only one element to run the activation it will be normalized always as 1. It is used mostly for categorical prediction (i.e. among several possibilities only one is correct). You are getting $0$/$NaN$ loss because your model always return 1. Instead of using softmax activation you might try sigmoid activation, so you can interpret the result of the network evaluation as the probability of survive.

Marcelo Fornet

Posted 2017-12-24T09:41:33.190

Reputation: 113