回归模型——使用graphlab,进行房价预测分析(环境:python、jupyter notebook、graphlab)

一、导入graphlab,并进行读取数据集

回归模型——使用graphlab,进行房价预测分析(环境:python、jupyter notebook、graphlab)_第1张图片

二、数据展示:散点图:Scatter Plot,x 和 y 坐标

回归模型——使用graphlab,进行房价预测分析(环境:python、jupyter notebook、graphlab)_第2张图片

三、分理处训练集和测试集:

train_data,test_data = sales.random_split(.8,seed=0)

利用训练集创建单特征模型,features参数为列表

sqft_model = graphlab.linear_regression.create(train_data,target="price",features=['sqft_living'])

回归模型——使用graphlab,进行房价预测分析(环境:python、jupyter notebook、graphlab)_第3张图片

四、预测结果分析:

回归模型——使用graphlab,进行房价预测分析(环境:python、jupyter notebook、graphlab)_第4张图片

五、构造更多特征的模型:

my_features = ['bedrooms','bathrooms','sqft_living','sqft_lot','floors','zipcode']

回归模型——使用graphlab,进行房价预测分析(环境:python、jupyter notebook、graphlab)_第5张图片

六、比较单特征模型和多特征模型:

回归模型——使用graphlab,进行房价预测分析(环境:python、jupyter notebook、graphlab)_第6张图片

七、总结:

单特征和多特征相比,并不一定哪个一定好。拟合程度要合适,多拟合也会预测不准确。

(正在学习中,待更新......)

你可能感兴趣的:(人工智能)