Understand why you make hypotheses with Linear Regression Make a line of Hypothesis Understand the Loss Function that can identify hypotheses that are close to the correct answer
the term | Description |
---|---|
Linear Regression | Linear regression |
Hypothesis | hypothesis |
the term | Description |
---|---|
H(x) | Hypothesis |
Wx | Inclined(W (I don't know what it stands for)) |
b | deviation(bias) |
For the sake of simplicity, we have prepared the following training data.
x | y |
---|---|
1 | 1 |
2 | 2 |
3 | 3 |
This is expressed linearly as follows.
There are many such linear and predictable things in the world. For example:
If you want to estimate the rent of a house (the larger the house, the higher the rent) If you want to predict your exam grades (the more time you spend studying, the higher your grades)
And so on.
Let's make a line to make a hypothesis Training data x and arbitrary data Make it by adding W and b.
In the formula, write as follows.
The figure below is a linear version of three hypotheses.
Because the training data is x = 1, y = 1, x = 2, y = 2, x = 3, y = 3 You can see that the blue line applies to the training data. (There are only three hypotheses) But we need a way to find it mathematically so that the computer can understand it.
Therefore, we use a Loss Function.
Roughly speaking, Cost Function It is to compare the distance (y) between the "hypothetical line" and the "correct line" and identify that the shorter the distance, the more correct the line.
Compare the standing distances as shown in the figure below.
"Line made by hypothesis"-"Standing distance (y)" The formula I just said is as follows.
However, with this If y is larger than the hypothesized line It will be negative, so square it.
Applying this formula to this training data gives:
The training data is three, so I divided it by three.
To express it as an expression that can be used for millions of training data, express it as follows.
Where H is It was the result of So I think it can be expressed as follows.
Also, the smaller the cost value (W, b), the closer to the correct hypothesis can be identified. Therefore, it is expressed as follows.
Make a hypothetical line using training data and arbitrary W, b values The smaller the Cost (W, b) value, the closer to the correct line.
Recommended Posts