-1
$\begingroup$

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?

$\endgroup$
1
$\begingroup$

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$

| improve this answer | |
$\endgroup$
  • $\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 Mar 2 at 3:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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