The Hypothesis
When we just had one input variable x (size of house) and output y (cost of house) we had hypothesis
hθ(x) = θ0 + θ1x.
This generalises to
hθ(x1, x2, x3, ..., xn) = θ0 + θ1x1 + θ2x2 + θ3x3 + ... + θnxn
This notation is rather cumbersome, so we use a more convenient vector form. In order to do this, we put in an addition x0, which we set to one (as θ0=θ0*1=θ0x0.)
hθ(x0, x1, x2, x3, ..., xn) = θ0x0+ θ1x1 + θ2x2 + θ3x3 + ... + θnxn
Putting in this extra x0 enables us to use the following notation.
I will use bold font to indicate vectors so x is the vector above. Using this notation, and writing θ as a row vector by taking its transpose θT =( θ0, θ1x1, θ2, θ3x3, ... , θn) we can rewrite the hypothesis as hθ(x) = θTx. Note that this x is the vector x.
Relating this to the Single Variable
For the single variable hθ(x) = θ0 + θ1x, we rewrite it as
h(x0, x1) = θ0 x0+ θ1x1 = θTx, that is,
h(x) = θTx
where θT = (θ0, θ1) and
x= | ( | x0 x1 | ). |
No comments:
Post a Comment