3. 机器学习之实战 之 线性回归处理波士顿房价问题

本文探讨了波士顿房价的预测问题,通过线性回归模型进行入门实践。利用Python的sklearn库加载数据,分析参数与MEDV的相关性,选择合适的变量进行模型训练,以达到更好的线性拟合效果。
摘要由CSDN通过智能技术生成

波士顿房价问题

波士顿的房价为什么那么贵呢? 可以用什么方法预测房价呢? 这里的波士顿房价显然是连续变量,所以这个问题我们可以用回归来尝试解决。

今天我们就从最简单的线性回归来入门吧

数据加载与模型训练

波士顿房价的数据源Kaggle上也是免费开放的,Python的sklearn 数据集也可以直接load

from sklearn.datasets import load_boston
boston_dataset = load_boston()

我们一起来看一下这个数据集

print(boston_dataset.keys())
dict_keys(['data', 'target', 'feature_names', 'DESCR', 'filename'])

print(boston_dataset.DESCR)
. _boston_dataset:

Boston house prices dataset
---------------------------

**Data Set Characteristics:**  

    :Number of Instances: 506 

    :Number of Attributes: 13 numeric/categorical predictive. Median Value (attribute 14) is usually the target.

    :Attribute Information (in order):
        - CRIM     per capita crime rate by town
        - ZN       proportion of residential land zoned for lots over 25,000 sq.ft.
        - INDUS    proportion of non-retail business acres per town
        - CHAS     Charles River dummy variable (= 1 if tract bounds river; 0 otherwise)
        - NOX      nitric oxides concentration (parts per 10 million)
        - RM       average number of rooms per dwelling
        - AGE      proportion of owner-occupied units built prior to 1940
        - DIS      weighted distances to five Boston employment centres
        - RAD      index of accessibility to radial highways
        - TAX      full-value property-tax rate per $10,000
        - PTRATIO  pupil-teacher ratio by town
        - B        1000(Bk - 0.63)^2 where Bk is the proportion of blacks by town
 
  • 1
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值