2
$\begingroup$

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?

$\endgroup$
  • $\begingroup$ Specifically, theta0 is the bias and theta1 is 'slope' of the regression line. $\endgroup$ – Daniel Feb 15 '18 at 18:20
2
$\begingroup$

Linear regression is always associated with an activation function, the weights between layers and the structure of the network. The weights between layers are theta0 and theta1. This weights and the input features undergoes the dot product operation which is then the input to the activation function of the next layers node/nodes.

An apparently different but the same use of theta0 and theta1 is as coefficients to one or more number of terms which themselves are combination of the input vectors.

Broadly theta-n denotes an weight i.e. how much preference you want to give to a feature.

$\endgroup$
1
$\begingroup$

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?

$\endgroup$
1
$\begingroup$

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}$$

$\endgroup$
0
$\begingroup$

The aim of reinforcement learning is to make an agent which plays games. The agent uses weights in his policy for adapting the decisions to the game. Learning means, that the agent changes it's weights. The cost function defines how good the agent has adapted the weights to the problem. Linear regression is a method for determine the weights inside the policy. Instead of linear regression any other algorithm like hill climbing, simulated annealing or brute force can be used. The general idea is, that the agent fluctuates his weights until he has won the game.

The equation of Andrew Ng can't be seen as a tutorial of how to construct the agent, it is more a self-referential symbol in a proof-workflow. That means, the formula is used together with many more of them to fulfil a thought-system which has nothing to do with agent-programming itself.

$\endgroup$
  • 2
    $\begingroup$ This isn't necessarily right to imply that reinforcement learning is the general goal here. Reinforcement learning is a subset of machine learning, and machine learning can be applied to reinforcement learning; Andrew Ng's course is on machine learning not reinforcement learning. $\endgroup$ – skim Feb 20 '18 at 19:23
  • $\begingroup$ @skim: There is not difference between them. Both techniques are working data-oriented, that means example input-output vectors are given and the learned model maps between them. The weights of the model are fluctuating and it's up to the programmer to find them. $\endgroup$ – Manuel Rodriguez Feb 20 '18 at 19:46

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.