Classification threshold using Tanh

267 views
Skip to first unread message

lvd...@gmail.com

unread,
Feb 7, 2017, 1:33:05 PM2/7/17
to Keras-users
Hi All,

I know that with sigmoid, default classification boundary of 0.5 can be used to classify a binary output. What is the similar threshold for Tanh? Also, what default threshold does Keras implement? Is it >0 and <0?
I am only concerned about the output layer.

Thanks

Hui Liu

unread,
Feb 7, 2017, 11:55:45 PM2/7/17
to Keras-users, lvd...@gmail.com


在 2017年2月8日星期三 UTC+8上午2:33:05,lvd...@gmail.com写道:
I think the tanh function is not similar with the  sigmoid function. I think the Tanh function is not suitable as the output layer.

If you handle a binary classification problem, you can use sigmoid function(the threshold is 0.5).
If you handle a n classification problem, you can use softmax function(the biggest one is the prediction class).

Because the tanh function come out a real data -inf to inf. 

Daπid

unread,
Feb 8, 2017, 10:03:15 AM2/8/17
to Lovedeep Singh, Keras-users
Keras doesn't care what activation you have in the output layer. It
rounds the outputs, and if they match the labels it is correct, else
it is wrong.

https://github.com/fchollet/keras/blob/master/keras/metrics.py#L5

If your model predicts 2.3, it will be rounded to 2.0, and that is not
going to match either 0 nor 1.
> --
> You received this message because you are subscribed to the Google Groups
> "Keras-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to keras-users...@googlegroups.com.
> To view this discussion on the web, visit
> https://groups.google.com/d/msgid/keras-users/b1b84084-8810-45ec-b5c3-21b882a65624%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages