+ 5
Why does my code not work for axis = 1: I want to stanardize a matrix
See my prog and change axis to 1 https://code.sololearn.com/cA12a0A14a12/#py
6 Respostas
+ 2
My guess: The dimensions of A and mean and std don't match, so you are trying to perform an operation that is not defined for matrix calculation.
(What is your in trying to standardize this array by column?)
+ 2
Axis:
"[...] Note, that this only works with the first dimension, otherwise the shapes will not match for broadcasting. If you want to normalize wrt another axis you need to do something like:
x -= np.expand_dims(np.mean(x,axis = n),n)"
https://stackoverflow.com/questions/45834276/numpyzero-mean-data-and-standardization
+ 2
Ich versteh kein Wort..,
Erkläre mir bitte den zweiten Teil.... da drückt der Schuh, das möchte ich verstehen.
I am newbie to this please explain part 2 in detail.
+ 2
Lisa u know the spotify dataset?
0
If you wanted to do it "the other way round, you could np.transpose(A) before doing any further calculations. (See code)
I did not test if/how the quoted code works. Just wanted to highlight the paragraph.
Aber mal aus Anwendungsperspektive:
Normalerweise bedeuten die Zahlen ja irgendwas. Die Konvention ist Spalten = abhängige Variablen/Messungen, Zeilen = Beobachtungseinheiten, z.B. Frogged, Lisa, Harry Potter... Axis=1: In welchem Fall würde man nach Personen standardisieren wollen??? Ich nehme an, numpy hat v.a. die default Anwendungsfälle im Blick.
https://code.sololearn.com/cAJb9w8b5zIf/?ref=app
0
Frogged Which course? I haven't done it all yet...
edit:
I added some comments in my code.