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
Minor doc improve #985
base: master
Are you sure you want to change the base?
Minor doc improve #985
Conversation
616686e
to
0b8a2ff
Compare
Co-Authored-By: Mihir Gadgil <scimas@users.noreply.github.com>
Co-Authored-By: Mike J Innes <mike.j.innes@gmail.com>
Could you merge this? Doc improvement PRs should be in bit size, so they get merged fast. I will create more PRs, as I read more |
You are right. It's still possible to split that PR up, though! |
What is holding this back from getting merged? 😞 People will stop contributing if their PRs don't merge. |
@@ -20,20 +20,21 @@ julia> d2f(2) | |||
6 | |||
``` | |||
|
|||
When a function has many parameters, we can get gradients of each one at the same time: | |||
When a function has many parameters, we can get gradients of each one at the same time by passing each one as an argument: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would keep only this change and leave the rest as it is since it seems redundant
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What changes are redundant? Do you mean the information about the example!?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
all changes except the line above, in my opinion. I prefer the previous version
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am describing the syntax. I don't dee this as redundant.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Apologies for letting this fall through the cracks. I've added some suggestions to deduplicate the wording and slim down the copy a bit. @CarloLucibello do you mind taking another look?
@@ -20,20 +20,21 @@ julia> d2f(2) | |||
6 | |||
``` | |||
|
|||
When a function has many parameters, we can get gradients of each one at the same time: | |||
When a function has many parameters, we can get gradients of each one at the same time by passing each one as an argument: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When a function has many parameters, we can get gradients of each one at the same time by passing each one as an argument: | |
When a function has many parameters, we can get the gradient with respect to each in a single call: |
|
||
```jldoctest basics | ||
julia> f(x, y) = sum((x .- y).^2); | ||
|
||
``` | ||
For this `f`, we can get the gradient with respect to both `x` and `y` in a single call: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For this `f`, we can get the gradient with respect to both `x` and `y` in a single call: |
If the "with respect to" is moved up top, this line is no longer necessary.
julia> gradient(f, [2, 1], [2, 0]) | ||
([0, 2], [0, -2]) | ||
``` | ||
where `x = [2, 1]` and `y = [2, 0]`. The above syntax is the same as: `df(x,y) = gradient(f,x,y); df([2,1], [2,0])` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
where `x = [2, 1]` and `y = [2, 0]`. The above syntax is the same as: `df(x,y) = gradient(f,x,y); df([2,1], [2,0])` | |
The above syntax is the same as: `df(x,y) = gradient(f,x,y); df([2,1], [2,0])` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Having a statement like "where ..." is a little cumbersome. Since df(x, y)
already names the parameters, there's no need to define them in prose. Alternatively, you could actually declare them in the doctest with x, y = ...
, but that might be confusing given f(x, y)
has already been defined earlier (users who aren't comfortable with scoping may conflate the two).
Feel free to update the branch. |
Ready
Doesn't overlap with #853