Section I: Code Bundle and Result Analyses
The relationship between house prices and LSTAT(percent lower status of the population) will be fitted via the second degree (quadratic) and the third degree (cubic) polynominals as well as linear fit here.
FROM
Sebastian Raschka, Vahid Mirjalili. Python机器学习第二版. 南京:东南大学出版社,2018.
代码
from sklearn import datasets
from sklearn.model_selection import train_test_split
from sklearn.linear_model import LinearRegression
from sklearn.preprocessing import PolynomialFeatures
from sklearn.metrics import mean_squared_error,r2_score
import matplotlib.pyplot as plt
import numpy as np
import warnings
warnings.filterwarnings("ignore")
plt.rcParams['figure.dpi']=200
plt.rcParams['savefig.dpi']=200
font = {
'family': 'Times New Roman',
'

本文通过二次(二次)和三次(三次)多项式,以及线性拟合,分析了房屋价格与LSTAT(人口较低地位的百分比)之间的关系。引用自Sebastian Raschka和Vahid Mirjalili的《Python机器学习》第二版。
最低0.47元/天 解锁文章
1134

被折叠的 条评论
为什么被折叠?



