《Python机器学习及实践:从零开始通往Kaggle竞赛之路》第2章 基础篇 学习笔记(九)2.1.2.3K近邻(回归)总结

目录

2.1.2.3K近邻(回归)

1、模型介绍

2、数据描述

(1)美国波士顿地区房价数据描述

(2)美国波士顿地区房价数据分割

(3)美国波士顿地区房价数据标准化处理

3、编程实践

4、性能测评

5、特点分析


2.1.2.3K近邻(回归)

1、模型介绍

在回归任务中,K近邻(回归)模型同样只是借助周围K个最近训练样本的目标数值,对待测样本的回归值进行决策。自然,也衍生出衡量待测样本回归值的不同方式,即到底是对K个近邻目标数值使用普通的算术平均算法,还是同时考虑距离的差异进行加权平均。因此,也初始化不同配置的K近邻(回归)模型来比较回归性能的差异。

2、数据描述

(1)美国波士顿地区房价数据描述

# 代码34:美国波士顿地区房价数据描述
# 从sklearn.datasets导入波士顿房价数据读取器。
from sklearn.datasets import load_boston

# 从读取房价数据存储在变量boston中。
boston = load_boston()
# 输出数据描述。
print(boston.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
        - LSTAT    % lower status of the population
        - MEDV     Median value of owner-occupied homes in $1000's

    :Missing Attribute Values: None

    :Creator: Harrison, D. and Rubinfeld, D.L.

This is a copy o
  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值