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
Choose a base branch
from

Conversation

@davidbenncsiro
Copy link
Contributor

@davidbenncsiro davidbenncsiro commented Aug 20, 2019

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

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 pushed a commit to davidbenncsiro/python-novice-inflammation that referenced this issue Aug 20, 2019
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 pushed a commit to davidbenncsiro/python-novice-inflammation that referenced this issue Aug 20, 2019
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 pushed a commit to davidbenncsiro/python-novice-inflammation that referenced this issue Aug 20, 2019
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.
Modified the suggested change after realising that the wording was correct, but could perhaps be clarified.
Suggested clarifying wording for axis=1
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
Simplified clarifying text.
@maxim-belkin
Copy link
Contributor

@maxim-belkin maxim-belkin 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...

Loading

@davidbenncsiro
Copy link
Contributor Author

@davidbenncsiro davidbenncsiro commented Aug 27, 2019

No worries. That sounds quite reasonable @maxim-belkin

Thanks.

Loading

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants