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

cleanup of rate_distortion #25

Merged
merged 5 commits into from
Jan 10, 2024
Merged

cleanup of rate_distortion #25

merged 5 commits into from
Jan 10, 2024

Conversation

nathimel
Copy link
Collaborator

Minor changes to previous request #24, including

  • adding rdot to the pyproject.toml dependencies list, and removed instructions in README about installing via git.
  • cleanup of some docstrings

Copy link
Collaborator

@shanest shanest left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a few very minor style things, mainly to make sure I understand what's going on. It looks great overall!! And just make sure to let me know and/or update ultk if the rdot API ever changes, though I suspect that will be pretty stable :). Cheers!


`distortion`: the distortion E[DKL[ M || M_hat ]] = I[M:U] - I[W:U], in bits
"""
args = [language, prior, meaning_dists]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

incredibly minor, but best for this to be a tuple not a list

"""
args = [language, prior, meaning_dists]
return ib_encoder_to_point(
*args[1:], language_to_ib_encoder_decoder(*args).values()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does the language_to... not also need a * in front of it?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, I feel like this might be easier to read if you just get the raw dict from language_to_ib.... in the body, and then send in in ["encoder"] and ["decoder"] here

Returns:
array of shape `(|words|, |meanings|)` representing the 'optimal' deterministic decoder
"""
return bayes(encoder, prior) @ meaning_dists
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

beautiful!


complexity = information_cond(prior, encoder)
accuracy = MI(meaning_dists @ joint(encoder, prior))
distortion = MI(joint(meaning_dists, prior)) - accuracy
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a comment or two on these lines, or a bit more detail in the docstring, would be helpful

betas,
*args,
**kwargs,
).get_results()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very cool! Wondering if we might want to expose the raw optimizer separate from the results at some place, but that's easy to do in the future if we need to

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interested to hear more! In principle I can imagine one might want the IBOptimizer instance to look at in addition to getting a curve, since it does indeed contain a lot of useful data and methods.

@nathimel
Copy link
Collaborator Author

Just a few very minor style things, mainly to make sure I understand what's going on. It looks great overall!! And just make sure to let me know and/or update ultk if the rdot API ever changes, though I suspect that will be pretty stable :). Cheers!

Thanks for reviewing! This rdot via ultk stuff is actively being used by my signaling + IB project, which has yet to be finished so that should help with keeping things up to date.

@nathimel nathimel merged commit 87e5dc2 into main Jan 10, 2024
2 checks passed
mickeyshi pushed a commit that referenced this pull request Mar 5, 2024
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

Successfully merging this pull request may close these issues.

2 participants