python svr回归_机器学习入门之机器学习之路:python支持向量机回归SVR 预测波士顿地区房价...

本文主要向大家介绍了机器学习入门之机器学习之路:python支持向量机回归SVR  预测波士顿地区房价,通过具体的内容向大家展现,希望对大家学习机器学习入门有所帮助。

支持向量机的两种核函数模型进行预测

git: https://github.com/linyi0604/MachineLearning

from sklearn.datasets import load_boston

from sklearn.cross_validation import train_test_split

from sklearn.preprocessing import StandardScaler

from sklearn.svm import SVR

from sklearn.metrics import r2_score, mean_squared_error, mean_absolute_error

import numpy as np

# 1 准备数据

# 读取波士顿地区房价信息

boston = load_boston()

# 查看数据描述

# print(boston.DESCR)   # 共506条波士顿地区房价信息,每条13项数值特征描述和目标房价

# 查看数据的差异情况

# print("最大房价:", np.max(boston.target))   # 50

# print("最小房价:",np.min(boston.target))    # 5

# print("平均房价:", np.mean(boston.target))   # 22.532806324110677

x = boston.data

你可能感兴趣的:(python,svr回归)