Go to: The blog of the depths of the cloud: https://blog.csdn.net/pakko/article/details/37527799
Summarizing the theoretical part of linear regression , let 's practice linear regression with the second-hand housing data of Pudong Tangqiao .
Data and code connection download , tools use Octave .
1. Data acquisition
Crawl from the website to the data and organize it into what we need. The crawling method is inconvenient to talk about, I use jsoup.
2. Data filtering
After climbing to the data, the data of the room area less than 30 square meters and greater than 150 square meters were filtered, and the total price greater than 800w was also filtered. (these data are too small or too large)
3. Univariate Linear Regression
x represents the area of the house and y represents the house price, which is calculated using the method of the normal equation system.
After getting the code, execute one.
The execution result is as follows:
4. Multiple Linear Regression
x represents the area of the house, the number of rooms, and the floor, and y represents the house price, which is calculated using the method of the normal equation system.
After you get the code, you can execute multi.
The execution result is as follows: