I'm going through an article on linear regression, and they give the following formula for computing estimates:

enter image description here

The convention is that all vectors are column vectors. So if n is the number of samples and m is the number of parameters, hw(x) has dimensions n x 1, wT has dimensions 1 x m, and x has dimensions n x m. The problem is that these dimensions don't work out for matrix multiplication.

Where have I gone wrong here?


1 Answer 1


My guess is that $x$ here refers to a single datapoint with shape $m$x$1$. So $h_w(x)$ and $w^Tx$ both have shape $1$. In the case of multiple datapoints given as a matrix $X$ of shape $n$x$m$, the equation becomes:

$h_w(X) = Xw$

  • $\begingroup$ Indeed I think would be more consistent to have written the case in the OP as $x^Tw$. It doesn't make much sense to think of one data point as a column vector when the design matrix is inherently by convention a bunch of data as row vectors. $\endgroup$
    – Sean Owen
    Commented Mar 2, 2020 at 3:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.