https://365datascience.com/dwqa-answer/answer-for-adding-a-row-and-column-vector-in-numpy/ -
Hi Yash,
thank you for reaching out!
The operation + sums the two vectors by adding corresponding elements.
For the example you’ve shown:
Adding a 3×1 row_vector and 1×3 column_vector, results in a 3*3 matrix, where each element (i, j) equals:
row_vector(j) + column_vector(i).
So, for the first row in your example we’d have [ row_vector_1 + column_vector_1, row_vector_2 + column_vector_1, row_vector_3 + column_vector_1] = [1+1, 2+1, 3+1]
Generally on the topic of vector sums using +:
To be able to use + the two elements need to be compatible. Two inputs have compatible sizes if, for every dimension, the dimension sizes of the inputs are either the same or one of them is 1.
Hope this sheds some light on the topic!
Best,
Eli
#365datascience #DataScience #data #science #365datascience #BigData #tutorial #infographic #career #salary #education #howto #scientist #engineer #course #engineer #MachineLearning #machine #learning #certificate #udemy
No comments:
Post a Comment