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

Prose error describing numpy rows and columns relative to axis number... #321

Open
KjellSwedin opened this issue Oct 7, 2016 · 2 comments
Labels
good first issue Good issue for first-time contributors help wanted Looking for Contributors
Milestone

Comments

@KjellSwedin
Copy link

The following line shows rows with axis 0:

"If we ask for the average across axis 0 (rows in our 2D example), we get:"

and here columns are show with axis 1:

"If we average across axis 1 (columns in our 2D example), we get:"

The diagram above correctly shows axis 0 as columns and axis 1 as rows.

@djinnome
Copy link

djinnome commented Jan 9, 2017

Perhaps this episode has been updated since October 7, but the prose looks correct to me and consistent with the diagram, although it could be clearer. The current text is a bit glib about the semantics of axis, which could lead to confusion.

numpy.mean(data, axis=0) means "Take the average across all rows (axis=0) for each column. The diagram shows the result, which is a vector of columns".

Likewise, numpy.mean(data, axis=1) means "Take the average across all columns (axis=1) for each row. The diagram shows the result, which is a vector of rows".

The main inconsistency that I would like to report is that the diagram uses object notation to take the mean:

data.mean(axis=1)

whereas the code cell uses functional notation:

print(numpy.mean(data, axis=1))

While both notations are correct, this discrepancy adds more cognitive burden to the learner.

Secondly, in the diagram, the axis=1 example is shown first, followed by the axis=0 example, whereas in the code cells, the axis=0 example is shown first, followed by the axis=1 example. Again, while both the code and the diagram are correct, it adds more cognitive burden to the learner than if the examples were consistent in their ordering.

Finally, in the diagram, the axis=1 example applies the max operator, and the axis=0 example applies the mean operator, but in the code cells directly following the diagram, both examples apply the mean operator. If there were more parallelism between the diagram and the code, then the episode would be easier to learn.

rgaiacs pushed a commit to rgaiacs/swc-python-novice-inflammation that referenced this issue May 6, 2017
@valentina-s
Copy link
Contributor

Yes, it will be great if those clarifications are added and the inconsistencies are eliminated. PR's welcome!

@fmichonneau fmichonneau added help wanted Looking for Contributors good first issue Good issue for first-time contributors and removed help-wanted labels Jun 8, 2018
@ErinBecker ErinBecker added this to the June 2019 Release milestone May 14, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good issue for first-time contributors help wanted Looking for Contributors
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants