How can the list of vectors be naturally normalized in NumPy?
Here is an example that no work: last operation yield "size mismatch: objects can not be transmitted in a shape." edit : Why does not it work when adding a dimension to Well, unless I miss something, it works: Your problem suggestion is the broadcast rule. The size does not have the same length! Therefore, the rule is to first extend a small size at left : You can do the same: If you want Vectors
How can the generalization of 2D vectors be done beautifully NumPy? criteria
(according to my answer)?
vectors / norms
vectors # Size 2, 10 criteria # Size 10
Criteria # Size 1,10
vectors / norms.reshape (1, -1) Similar to # vectors / criteria
Calculate the vectors.T / Criterion
, you must manually reset, as is the following:
vectors.T / norms.reshape (-1,1) # This works
Comments
Post a Comment