# Am I fundamentally misunderstanding the net input dot product w*x

Most books have the notation of a weight vector w and input matrix x: $$w = \begin{bmatrix} w_1\\...\\ w_D \end{bmatrix}, x = \begin{bmatrix} x_{11}&...&x_{1D}\\ ...&...&...\\ x_{N1}&...&x_{ND} \end{bmatrix}$$ For N samples and D features/parameters. Then it goes on to say the net input, or y prediction, or whatever the book decides to call it, is $$y=w^Tx$$ But doesn't that mean every sample of the 1st feature is multiplied with weights $$w_1, w_2,...w_D$$? Intuition tells me it should be each $$d$$-th feature should be multiplied by the correspnding $$d$$'th weight, done over all samples. By this reasoning it should be more like $$y=xw$$, which I've definitely never seen in any of the books. What am I getting wrong?

PS I realized I missed the bias; hopefully the argument still stands.

• As written, the dimensions aren't compatible for multiplication: $w^T$ is $1 \times D$ and $x$ is $N\times D$, so the product $w^T x$ isn't defined unless $N = D$. Writing $y = x w$ is in this context is correct, and it written that way in many places – Artem Mavrin Feb 29 at 21:23

The formula your "most books" give cannot be right because, in general, $$N \neq D$$. Consequently, you cannot multiply a row vector of length $$D$$ with a matrix containing $$N$$ rows. Thats simple linear algebra.
• I see no proof on slide 9/30. But I admit, the notation may be misleading, because it mixes vectors and one-dimensional matrices. You can consider both $w^T$ and $x$ to be vectors, so $w^T x$ is simply a dot product. If you understood them as one-dimensional matrices ($x$ a single-row matrix, $w$ a single-column matrix), you'd need to write $x w$. On the slide 11/30, where multiple observations are collected as rows in the matrix $X$ (capital X!), this is actually the notation used: $X w$. – Igor F. Feb 29 at 21:45