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

Episode 2: array/vector dimensions #898

Open
SRSteinkamp opened this issue Jan 19, 2021 · 1 comment
Open

Episode 2: array/vector dimensions #898

SRSteinkamp opened this issue Jan 19, 2021 · 1 comment

Comments

@SRSteinkamp
Copy link
Contributor

Hi there,

so this might be a bit pedantic, but in preparing for the instructor checkout I stumbled over the following expression in episode 2 (Analyzing Patient Data).

In describing using the axis argument, for example in numpy.mean(data, axis=1), there is a statement about checking the output dimensions:
The expression (40,) tells us we have an N×1 vector, so this is the average inflammation per day for all patients. If we average across axis 1 (columns in our 2D example), we get:

I think stating that it is a N x 1 vector like this is a bit problematic, as it suggest the vector has 2 dimensions, which it actually has not. And it also clashes a bit with the challenges about Stacking Arrays, where is some notion about how to keep or remove dimensions and facilitate stacking - but not that summarizing functions like numpy.mean also remove dimensions.

One reason for me putting this up, is that you cannot stack arrays of shape = (40,) and arrays of shape = (40,1). And np.stack will treat 1-D vectors as column vectors and not row vectors as suggested above.

I think possible solutions might be, either to change:
The expression (40,) tells us we have an N×1 vector, so this is the average inflammation per day for all patients. If we average across axis 1 (columns in our 2D example), we get:
to
The expression (40,) tells us we have a vector of length 40, so this is the average inflammation per day for all patients. If we average across axis 1 (columns in our 2D example), we get:
or mention that numpy.mean etc. also remove the dimensions in the Stacking Array challenge.

I am happy to create a pull-request if you agree :)

Cheers,
Simon

@ldko
Copy link
Contributor

ldko commented Apr 16, 2021

To me N x 1 vector doesn't suggest 2 dimensions, but not sure how others view it. I think changing the text to a vector of length 40 would be ok though. Any thoughts on this @maxim-belkin ?

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

No branches or pull requests

2 participants