引入相关依赖的包
防止不必要的警告
import warnings
warnings.filterwarnings("ignore")
引入数据科学基础包
import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt
import pandas as pd
import scipy.stats as st
import seaborn as sns
设置属性防止画图中文乱码
mpl.rcParams['font.sans-serif'] = [u'SimHei']
mpl.rcParams['axes.unicode_minus'] = False
引入机器学习,预处理,模型选择,评估指标
from sklearn.preprocessing import StandardScaler
from sklearn.model_selection import train_test_split
from sklearn.model_selection import GridSearchCV
from sklearn.metrics import r2_score
引入本次所使用的波士顿数据集
from sklearn.datasets import load_boston
引入算法
from sklearn.linear_model import RidgeCV, LassoCV, LinearRegression, ElasticNet
对比SVC,是svm的回归形式
from sklearn.svm import SVR
集成算法
from sklearn.ensemble import RandomForestRegressor, GradientBoostingRegressor
from xgboost import XGBRegressor