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

Docs for onecold #2134

Merged
merged 2 commits into from
Dec 15, 2022
Merged

Docs for onecold #2134

merged 2 commits into from
Dec 15, 2022

Conversation

nathanielvirgo
Copy link
Contributor

Describe the behaviour of onecold when given a probability distribution as input, since it's not what one would expect.

minor documentation change

PR Checklist

  • Tests are added
  • Entry in NEWS.md
  • [ X ] Documentation, if applicable

Describe the behaviour of `onecold` when given a probability distribution as input, since it's not what one would expect.
The inverse is `onecold` (which can take a general probability distribution, as well as just booleans).
The inverse is `onecold`. This function can take a general probability distribution, as well as just booleans. However, when given a probability distribution it doesn't sample from it but just returns the element with the highest probability.
Copy link
Member

Choose a reason for hiding this comment

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

Maybe "probability distribution" is misleading, it doesn't care, takes any old array of numbers --- it's just argmax except that it translates an index to some given labels.

I think "inverse" is misleading too. It un-does onehot, but is normally used on arrays that look nothing like what onehot produces.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I agree that "probability distribution" is misleading. (I called it that because that's what the current text calls it, but it probably shouldn't.)

I don't know how to update the pull request, but maybe something like this would be better:

There is also a onecold function, which is an inverse of onehot. It can also be given an array of numbers instead of booleans, in which case it performs an argmax-like operation, returning the label with the highest corresponding weight.

Copy link
Member

Choose a reason for hiding this comment

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

That sounds great.

You should be able to edit your branch, here:

https://github.com/nathanielvirgo/Flux.jl/blob/patch-1/docs/src/data/onehot.md

Further commits will show up in this PR.

@mcabbott mcabbott changed the title Update onehot.md Docs for onecold Dec 14, 2022
@mcabbott mcabbott merged commit 4a2dc27 into FluxML:master Dec 15, 2022
@mcabbott
Copy link
Member

Thanks!

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