0
$\begingroup$

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?

$\endgroup$
  • $\begingroup$ The output is one, the classes are 2 and hence when converted to categorical column, have two columns $\endgroup$ – Nain Dec 24 '17 at 12:28
  • $\begingroup$ @Nain so if i have 3 output, the classes will be 6? $\endgroup$ – Zahi Azmi Dec 25 '17 at 9:12
  • $\begingroup$ Nope, it would be three only $\endgroup$ – Nain Dec 25 '17 at 14:16
1
$\begingroup$

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.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.