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

Update 01-numpy.md: clarifying text for axis=0,1 when averaging #695

Open
wants to merge 5 commits into
base: gh-pages
from

Conversation

@davidbenncsiro
Copy link
Contributor

commented Aug 20, 2019

I've suggested some clarifying text (see diffs) for axis=0 and axis=1 when computing average.

Update 01-numpy.md
I think we mean "columns" rather than "rows" here, for axis=0, since for
~~~
print(numpy.mean(data, axis=0))
~~~
we get 0 in the zeroth element of the output array since the zeroth column of data is all zeros.
davidbenncsiro added a commit to davidbenncsiro/python-novice-inflammation that referenced this pull request Aug 20, 2019
Update 01-numpy.md
I think we mean "rows" rather than "columns" here, for axis=1, since for
~~~
print(numpy.mean(data, axis=1))
~~~
and indeed, we are averaging over all days for each patient (row).

See also PR swcarpentry#695
davidbenncsiro added a commit to davidbenncsiro/python-novice-inflammation that referenced this pull request Aug 20, 2019
Update 01-numpy.md
I think we mean "rows" rather than "columns" here, for axis=1, since for
~~~
print(numpy.mean(data, axis=1))
~~~
and indeed, we are averaging over all days for each patient (row).

See also PR swcarpentry#695
@davidbenncsiro davidbenncsiro referenced this pull request Aug 20, 2019
davidbenncsiro added a commit to davidbenncsiro/python-novice-inflammation that referenced this pull request Aug 20, 2019
Update 01-numpy.md
I think we mean "rows" rather than "columns" here, for axis=1, since for

print(numpy.mean(data, axis=1))
and indeed, we are averaging over all days for each patient (row).

See also PR swcarpentry#695

Please delete this line and the text below before submitting your contribution.
Update 01-numpy.md
Modified the suggested change after realising that the wording was correct, but could perhaps be clarified.
Update 01-numpy.md
Suggested clarifying wording for axis=1
Update 01-numpy.md
Made wording consistent for axis=0 and axis=1

@davidbenncsiro davidbenncsiro changed the title Update 01-numpy.md Update 01-numpy.md: clarifying text for axis=0,1 when averaging Aug 26, 2019

Update 01-numpy.md
Simplified clarifying text.
@maxim-belkin

This comment has been minimized.

Copy link
Contributor

commented Aug 26, 2019

Thank you for looking so closely into this, David.

I think the problem is in declaration of what we want: If we ask for the average across axis 0.
In reality, we don't care whether we need an average across axis 0, 1, or 10: we're interested either in a per-day average [inflammation] across all patients or per-patient average [inflammation] across all days.

What we show here is that numpy.mean(data, axis=0) "preserves" axis 0, which corresponds to rows in our data. As we know, each row holds information for a single patient. Therefore, numpy.mean(data, axis=0) reports per-day average inflammation across all patients. And I think this is what we need to say instead of average across axis 0...

@davidbenncsiro

This comment has been minimized.

Copy link
Contributor Author

commented Aug 27, 2019

No worries. That sounds quite reasonable @maxim-belkin

Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.