Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CLLR/Cross Entropy Calculation #5

Open
jfiscus opened this issue May 5, 2022 · 2 comments
Open

CLLR/Cross Entropy Calculation #5

jfiscus opened this issue May 5, 2022 · 2 comments

Comments

@jfiscus
Copy link

jfiscus commented May 5, 2022

In line

return cross_entropy(tar,non,Ptar=0.5,deriv=deriv)
, Should the output of cross_entropy be divided by log2 in cllr() rather than division occurring on
return ( Ptar*t + (1-Ptar)*n ) / log2
?

@bsxfan
Copy link
Owner

bsxfan commented May 5, 2022

Hi Jonathan

I think this code is doing what I intended. The division by log2 is to convert from nats to bits. The nats is because of the default use of the natural log everywhere. (I.E. we are converting from log base e to log base 2.) Since this is a binary classification problem, bits is perhaps the best scale on which to quantify information. With this scaling, 1 is a very useful reference point and we want that to hold for Cllr, but also more generally for prior-weighted cross-entropy (cross_entropy in the code) at any prior.

Cllr specializes the prior-weighted cross-entropy to the case where the prior weighting is flat (prior = 1/2). The prior and the scaling are independent choices---i.e. the prior = 1/2 and the log2 are not related.

-- Niko

@jfiscus
Copy link
Author

jfiscus commented May 5, 2022

Niko,

Thanks for the explanation of nats to bits - that makes sense. I'm working on a new evaluation plan that uses Cross Entropy, and Cllr. Does that mean that the cross_entropy function is actually calculating Cllr?

-Jon

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants