Skip to content
This repository was archived by the owner on Jul 1, 2023. It is now read-only.

Adding documentation for Kullback-leibler Divergence #239

Merged
merged 2 commits into from
Jun 14, 2019

Conversation

Shashi456
Copy link
Contributor

Refer to this.

cc: @eaplatanios.

@Shashi456 Shashi456 mentioned this pull request Jun 14, 2019
Copy link
Contributor

@rxwei rxwei left a comment

Choose a reason for hiding this comment

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

Thanks for putting this together. A few comments:

  1. Please wrap all math formulae within backquotes. In particular, p and q should be `p` and ` q`, respectively, and the formula on line 145 should also be backquoted.
  2. Please use "and" instead of "&" in documentation comment sentences. "&" should be especially not be used in between math terms to avoid confusion with logical conjunction.
  3. "KL-Distance" was not mentioned anywhere, and is very different from the standard terminology used in this API name. Naming and descriptive comments are very important to our APIs.
    • First, the short name should be "KL divergence", as it's the standard term used in the summary of this API and is a more canonical term of this operation.
    • Second, you should introduce the short name right after the first occurrence of the full name in a pair of parentheses. Namely, Returns the Kullback-Leibler divergence (KL divergence) between ....
  4. In the current comment, there are two consecutive "between"s. Please make sure the sentence reads grammatically.
  5. The formula on 145 appears to use an API called sum(_:), but such API does not exist in the our library and thus may not be relatable. Please use .sum() instead because that exists in our library. Also, for consistency, the / operator should leave a space before and after.
  6. For conciseness, I would suggest
Given two distribution `p` and `q`, KL divergence computes `(p * log(p / q)).sum()`.

@Shashi456
Copy link
Contributor Author

@rxwei thanks for the help, I've realized while writing doc comments is I tend to just consider if it makes sense to me and not someone who'd be interacting with the docs for the first time. I'll take more care from the next time

@rxwei
Copy link
Contributor

rxwei commented Jun 14, 2019

Thank you!

@rxwei rxwei merged commit 1b3f7c9 into tensorflow:master Jun 14, 2019
dan12411 pushed a commit to dan12411/swift-apis that referenced this pull request Jun 15, 2019
@Shashi456 Shashi456 deleted the doc branch June 16, 2019 18:38
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants