<p>As said above, they are weights to your hypothesis function that are changed during training to minimize your Error function. You can think of them like slope and y intercept in basic algebra. However, a linear regression hypothesis function can be parameterized by many more weight terms than just theta_0, and theta_1.</p>

<p>I detail this process more in this post: <a href="https://ai.stackexchange.com/questions/4629/how-does-an-activation-functions-derivative-measure-error-rate-in-a-neural-netw/4639#4639">How does an activation function&#39;s derivative measure error rate in a neural network?</a></p>

CC BY-SA 3.0
2018-02-20T04:22:05.090Z
2018-02-20T05:47:03.980Z
2018-02-20T05:47:03.980Z
sma
<p>The prediction made by linear regression can simply be thought of as a vector dot product.</p>

<p><span class="math-container">$$\overrightarrow{x}^T \cdot \overrightarrow{y}$$</span></p>

<p>One of those two vectors is the "data" for one case (like a row in your data matrix), the other is a vector of the model's parameters, which is usually called <span class="math-container">$\overrightarrow{\theta}$</span> or <span class="math-container">$\overrightarrow{\beta}$</span>.</p>

<p>So in the case shown by yourself, we have:</p>

<p><span class="math-container">$$h(x) = \theta_0 + \theta_1 \cdot x$$</span></p>

<p>Often we add a row of ones to the beginning of the data matrix, that way we are consistent in the sense that the <span class="math-container">$\theta_0 = 1 \cdot \theta_0$</span></p>

<p>This way we arrive at:</p>

<p><span class="math-container">$$h(x) = \overrightarrow{\theta}^T \cdot  \overrightarrow{x}$$</span></p>

CC BY-SA 4.0
2019-03-02T14:31:39.037Z
2019-03-02T14:31:39.037Z
BioHazZzZard
<p>I have completed week 1 of Andrew Ng's course. I understand that the cost function for linear regression is defined as <span class="math-container">$J (\theta_0, \theta_1) = 1/2m*\sum (h(x)-y)^2$</span> and the <span class="math-container">$h$</span> is defined as <span class="math-container">$h(x) = \theta_0 + \theta_1(x)$</span>. But I don't understand what <span class="math-container">$\theta_0$</span> and <span class="math-container">$\theta_1$</span> represent in the equation. Is someone able to explain this?</p>

CC BY-SA 3.0
2018-02-15T18:20:19.817Z
Specifically, theta0 is the bias and theta1 is 'slope' of the regression line.
Daniel
<linear-regression><math>
Understanding a few terms in Andrew Ng's definition of the cost function for linear regression
Nicholas Pysklywec
# Understanding a few terms in Andrew Ng's definition of the cost function for linear regression

(Asked by: username_0 on 2018-02-15)

I have completed week 1 of Andrew Ng's course. I understand that the cost function for linear regression is defined as $J (\theta\_0, \theta\_1) = 1/2m\*\sum (h(x)-y)^2$ and the $h$ is defined as $h(x) = \theta\_0 + \theta\_1(x)$. But I don't understand what $\theta\_0$ and $\theta\_1$ represent in the equation. Is someone able to explain this?

**Tags:** linear-regression, math

> **Comments:**
> **username_1**: Specifically, theta0 is the bias and theta1 is 'slope' of the regression line.  

---

## 2 answers

### Answer by username_2 on 2018-02-20. Score: 1

As said above, they are weights to your hypothesis function that are changed during training to minimize your Error function. You can think of them like slope and y intercept in basic algebra. However, a linear regression hypothesis function can be parameterized by many more weight terms than just theta\_0, and theta\_1.

I detail this process more in this post: [How does an activation function's derivative measure error rate in a neural network?](https://ai.stackexchange.com/questions/4629/how-does-an-activation-functions-derivative-measure-error-rate-in-a-neural-netw/4639#4639)


---

### Answer by username_3 on 2019-03-02. Score: 1

The prediction made by linear regression can simply be thought of as a vector dot product.

$$\overrightarrow{x}^T \cdot \overrightarrow{y}$$

One of those two vectors is the "data" for one case (like a row in your data matrix), the other is a vector of the model's parameters, which is usually called $\overrightarrow{\theta}$ or $\overrightarrow{\beta}$.

So in the case shown by yourself, we have:

$$h(x) = \theta\_0 + \theta\_1 \cdot x$$

Often we add a row of ones to the beginning of the data matrix, that way we are consistent in the sense that the $\theta\_0 = 1 \cdot \theta\_0$

This way we arrive at:

$$h(x) = \overrightarrow{\theta}^T \cdot \overrightarrow{x}$$


---

