Linear regression (least squares,)

Source: Internet
Author: User

1.

If there is a new area, assuming that there is no record of the price of the sale, and we want to know the price of the sale of the house, what should we do? The green dots in the figure are the points we want to predict.

Suppose we know the red line, then give the size of the house, and we can give the price of the house immediately. Therefore, we need to find such a red line.

2. Model Building

Just now we think that the price of housing is only related to area. In real life, the factors that affect house prices are many, such as the size of the house, the direction, the area, the number of rooms and so on. Considering more cases, we use X1,X2...XN to describe the factors that affect the price of a house, which are called features in machine learning. such as the area of x1= room, x2= room orientation and so on. Considering two variables, we can make an estimate function:

Θ is referred to here as the parameter, θ effect can adjust the price of the house various factors of the effect of the size. In other words, the factor that affects the price of a house is whether the area is more important or the room orientation is more important.

We make x0 = 1, we can use vectors to represent

In the above formula, once Theta is determined, then our straight line is determined, and we are able to forecast the house price. So the job we're going to do is to determine theta.

The value of θ can have countless, how should we choose θ?

3. Model Establishment-least squares

Only θ in the above equation is unknown, how to solve the minimum value of the function. Generally, the derivation of the objective function, the derivative is 0, the point to be obtained, that is, the extremum point, if the function is a convex function within the defined field, then the extremum point is the most value point. The above method is the least squares approach.

4. On the function extremum:

1. Gradient Descent method

2. Batch processing gradient descent method

3. Random Gradient Descent method

Linear regression (least squares,)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.