参考文献:《机器学习Python实战》魏贞原
博文目的:温习
工具:Geany
#导入类库
from pandas import read_csv #读数据
from pandas.plotting import scatter_matrix #画散点图
from pandas import set_option #设置打印数据精确度
import numpy as np
import matplotlib.pyplot as plt #画图
from sklearn.preprocessing import Normalizer #数据预措置惩罚惩罚:归一化
from sklearn.preprocessing import StandardScaler #数据预措置惩罚惩罚:正态化
from sklearn.preprocessing import MinMaxScaler #数据预措置惩罚惩罚:调解数据尺度
from sklearn.model_selection import train_test_split #疏散数据集
from sklearn.model_selection import cross_val_score #计算算法准确度
from sklearn.model_selection import KFold #交叉验证
from sklearn.model_selection import GridSearchCV #机器学习算法的参数优化要领:网格优化法
from sklearn.linear_model import LinearRegression #线性回归
from sklearn.linear_model import Lasso #套索回归
from sklearn.linear_model import ElasticNet #弹性网络回归
from sklearn.linear_model import LogisticRegression #逻辑回归算法
from sklearn.discriminant_analysis import LinearDiscriminantAnalysis #线性判别分析
from sklearn.discriminant_analysis import QuadraticDiscriminantAnalysis #二次判别分析
from sklearn.tree import DecisionTreeRegressor #决策树回归
from sklearn.tree import DecisionTreeClassifier #决策树分类
from sklearn.neighbors import KNeighborsRegressor #KNN回归
from sklearn.neighbors import KNeighborsClassifier #KNN分类
from sklearn.naive_bayes import GaussianNB #贝叶斯分类器
from sklearn.svm import SVR #撑持向量机 回归
from sklearn.svm import SVC #撑持向量机 分类
from sklearn.pipeline import Pipeline #pipeline能够将从数据转换到评估模型的整个机器学习流程进行自动化措置惩罚惩罚
from sklearn.ensemble import RandomForestRegressor #随即丛林回归
from sklearn.ensemble import RandomForestClassifier #随即丛林分类
from sklearn.ensemble import GradientBoostingRegressor #随即梯度上升回归
from sklearn.ensemble import GradientBoostingClassifier #随机梯度上分类
from sklearn.ensemble import ExtraTreesRegressor #极端树回归
from sklearn.ensemble import ExtraTreesClassifier #极端树分类
from sklearn.ensemble import AdaBoostRegressor #AdaBoost回归
from sklearn.ensemble import AdaBoostClassifier #AdaBoost分类
from sklearn.metrics import mean_squared_error #
from sklearn.metrics import accuracy_score #分类准确率
from sklearn.metrics import confusion_matrix #混淆矩阵
from sklearn.metrics import classification_report #分类呈报