线性回归:
1.假设模型
线性模型和线性关系是不同的,线性关系一定是线性模型,而线性模型不一定是线性关系
2.优化算法
正规方程
正规方程可以比作成一个天才,只需要一次就可以求出各种权重和偏置
梯度下降
梯度下降算法可以比作一个勤奋努力的普通人,需要不断的迭代和试错
3.sklearn实现
LinearRegression
LinearRegression使用的是正规方程,正规方程的时间复杂度太大。一般不使用。
SGDRegressor
SGDRegressor使用的是梯度下降。其中,数据量在1000K以上,推荐SGDRegressor,可以调节的量有学习率、学习步长、最大迭代次数,因此我们可以采用网格搜索和交叉验证的方式进行参数调节
4.模型评估使用MSE均方差来评估
岭回归就是适用梯度下降方法求解权重的线性回归算法
采用岭回归预测波士顿房价
# 岭回归预测波士顿房价
from sklearn.linear_model import Ridge
from sklearn.datasets import load_boston
from sklearn.preprocessing import StandardScaler
from sklearn.model_selection import train_test_split
from sklearn.model_selection import GridSearchCV
from sklearn.metrics import mean_squared_error
# 1.获取数据
data = load_boston()
# 2.数据集划分
x_train, x_test, y_train, y_test = train_test_split(data.data, data.target, random_state=22, test_size=0.2)
# 3.特征工程(标准化)
transfer = StandardScaler()
x_train = transfer.fit_transform(x_train)
x_test = transfer.transform(x_test)
# 4.岭回归流程
param_dict = {'alpha':[0.4, 0.5, 0.6, 0.7, 1, 2, 3, 4, 7, 10], 'max_iter':[120, 500, 1000, 5000, 10000, 20000]}
estimator = Ridge()
estimator = GridSearchCV(estimator=estimator, param_grid=param_dict, cv=10)
estimator.fit(x_train, y_train)
print(estimator.best_estimator_)
print(estimator.best_params_)
print(estimator.cv_results_)
# 5.模型评估
mean_squared_error(estimator.predict(x_test), y_test)
结果如下:
Ridge(alpha=10, max_iter=120) {'alpha': 10, 'max_iter': 120} {'mean_fit_time': array([1.69665813e-03, 9.97114182e-04, 4.98628616e-04, 3.98898125e-04, 6.98137283e-04, 9.97328758e-04, 9.97543335e-05, 4.98652458e-04, 4.98580933e-04, 0.00000000e+00, 9.99474525e-04, 3.96752357e-04, 1.99484825e-04, 7.93886185e-04, 6.98113441e-04, 6.98161125e-04, 1.99484825e-04, 5.98406792e-04, 4.98461723e-04, 3.98921967e-04, 9.97519493e-04, 2.99143791e-04, 0.00000000e+00, 4.98652458e-04, 7.97843933e-04, 2.99215317e-04, 6.98137283e-04, 4.98628616e-04, 3.99136543e-04, 1.00317001e-03, 7.91835785e-04, 0.00000000e+00, 8.97765160e-04, 9.97281075e-04, 9.97400284e-04, 4.98604774e-04, 0.00000000e+00, 9.97376442e-04, 9.97591019e-04, 4.98318672e-04, 4.98700142e-04, 8.97598267e-04, 8.97645950e-04, 2.99167633e-04, 0.00000000e+00, 1.99484825e-04, 1.99437141e-04, 9.97543335e-05, 2.99119949e-04, 3.98898125e-04, 8.97598267e-04, 7.97843933e-04, 6.02531433e-04, 5.98406792e-04, 3.98921967e-04, 8.97479057e-04, 9.97471809e-04, 9.97328758e-04, 9.97400284e-04, 9.97257233e-04]), 'std_fit_time': array([4.56330383e-04, 4.45955229e-04, 4.98628644e-04, 4.88548437e-04, 4.57038265e-04, 1.28392334e-07, 2.99263000e-04, 4.98652470e-04, 4.98581053e-04, 0.00000000e+00, 1.04580999e-05, 4.85947933e-04, 3.98969682e-04, 3.97115854e-04, 4.57022577e-04, 4.57053827e-04, 3.98969654e-04, 4.88597128e-04, 4.98461867e-04, 4.88577644e-04, 5.88367590e-07, 4.56949743e-04, 0.00000000e+00, 4.98652470e-04, 3.98921995e-04, 4.57058975e-04, 4.57038178e-04, 4.98628632e-04, 4.88840834e-04, 1.33272360e-05, 3.96287437e-04, 0.00000000e+00, 2.99255726e-04, 2.24923638e-07, 1.58148994e-07, 4.98604804e-04, 0.00000000e+00, 3.02519263e-07, 9.28302876e-07, 4.98319259e-04, 4.98700149e-04, 2.99199507e-04, 2.99215583e-04, 4.56986112e-04, 0.00000000e+00, 3.98969654e-04, 3.98874457e-04, 2.99263000e-04, 4.56913357e-04, 4.88548518e-04, 2.99200856e-04, 3.98922009e-04, 4.92108663e-04, 4.88597290e-04, 4.88577644e-04, 2.99159973e-04, 5.64704861e-07, 3.60792779e-07, 4.01790131e-07, 2.78041453e-07]), 'mean_score_time': array([8.97359848e-04, 4.98533249e-04, 4.98580933e-04, 9.97781754e-05, 0.00000000e+00, 0.00000000e+00, 4.98628616e-04, 0.00000000e+00, 5.02729416e-04, 2.99239159e-04, 0.00000000e+00, 5.98573685e-04, 0.00000000e+00, 0.00000000e+00, 2.99215317e-04, 1.99437141e-04, 3.98921967e-04, 0.00000000e+00, 4.98700142e-04, 0.00000000e+00, 0.00000000e+00, 6.98137283e-04, 3.98945808e-04, 9.99212265e-05, 0.00000000e+00, 3.98921967e-04, 0.00000000e+00, 4.98700142e-04, 3.98778915e-04, 0.00000000e+00, 1.99437141e-04, 4.98700142e-04, 9.97304916e-05, 0.00000000e+00, 0.00000000e+00, 4.98676300e-04, 4.98676300e-04, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 9.97066498e-05, 6.98137283e-04, 7.97843933e-04, 0.00000000e+00, 5.98192215e-04, 8.96525383e-04, 2.97355652e-04, 4.98628616e-04, 9.98258591e-05, 1.99437141e-04, 0.00000000e+00, 9.97066498e-05, 5.94353676e-04, 9.97304916e-05, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00]), 'std_score_time': array([0.00029912, 0.00049853, 0.00049858, 0.00029933, 0. , 0. , 0.00049863, 0. , 0.00050287, 0.0004571 , 0. , 0.00048873, 0. , 0. , 0.00045706, 0.00039887, 0.00048858, 0. , 0.0004987 , 0. , 0. , 0.00045704, 0.00048861, 0.00029976, 0. , 0.00048858, 0. , 0.0004987 , 0.0004884 , 0. , 0.00039887, 0.0004987 , 0.00029919, 0. , 0. , 0.00049868, 0.00049868, 0. , 0. , 0. , 0. , 0. , 0.00029912, 0.00045704, 0.00039892, 0. , 0.00048847, 0.00029905, 0.00045425, 0.00049863, 0.00029948, 0.00039887, 0. , 0.00029912, 0.00048543, 0.00029919, 0. , 0. , 0. , 0. ]), 'param_alpha': masked_array(data=[0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.6, 0.6, 0.6, 0.6, 0.6, 0.6, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 7, 7, 7, 7, 7, 7, 10, 10, 10, 10, 10, 10], mask=[False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False], fill_value='?', dtype=object), 'param_max_iter': masked_array(data=[120, 500, 1000, 5000, 10000, 20000, 120, 500, 1000, 5000, 10000, 20000, 120, 500, 1000, 5000, 10000, 20000, 120, 500, 1000, 5000, 10000, 20000, 120, 500, 1000, 5000, 10000, 20000, 120, 500, 1000, 5000, 10000, 20000, 120, 500, 1000, 5000, 10000, 20000, 120, 500, 1000, 5000, 10000, 20000, 120, 500, 1000, 5000, 10000, 20000, 120, 500, 1000, 5000, 10000, 20000], mask=[False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False], fill_value='?', dtype=object), 'params': [{'alpha': 0.4, 'max_iter': 120}, {'alpha': 0.4, 'max_iter': 500}, {'alpha': 0.4, 'max_iter': 1000}, {'alpha': 0.4, 'max_iter': 5000}, {'alpha': 0.4, 'max_iter': 10000}, {'alpha': 0.4, 'max_iter': 20000}, {'alpha': 0.5, 'max_iter': 120}, {'alpha': 0.5, 'max_iter': 500}, {'alpha': 0.5, 'max_iter': 1000}, {'alpha': 0.5, 'max_iter': 5000}, {'alpha': 0.5, 'max_iter': 10000}, {'alpha': 0.5, 'max_iter': 20000}, {'alpha': 0.6, 'max_iter': 120}, {'alpha': 0.6, 'max_iter': 500}, {'alpha': 0.6, 'max_iter': 1000}, {'alpha': 0.6, 'max_iter': 5000}, {'alpha': 0.6, 'max_iter': 10000}, {'alpha': 0.6, 'max_iter': 20000}, {'alpha': 0.7, 'max_iter': 120}, {'alpha': 0.7, 'max_iter': 500}, {'alpha': 0.7, 'max_iter': 1000}, {'alpha': 0.7, 'max_iter': 5000}, {'alpha': 0.7, 'max_iter': 10000}, {'alpha': 0.7, 'max_iter': 20000}, {'alpha': 1, 'max_iter': 120}, {'alpha': 1, 'max_iter': 500}, {'alpha': 1, 'max_iter': 1000}, {'alpha': 1, 'max_iter': 5000}, {'alpha': 1, 'max_iter': 10000}, {'alpha': 1, 'max_iter': 20000}, {'alpha': 2, 'max_iter': 120}, {'alpha': 2, 'max_iter': 500}, {'alpha': 2, 'max_iter': 1000}, {'alpha': 2, 'max_iter': 5000}, {'alpha': 2, 'max_iter': 10000}, {'alpha': 2, 'max_iter': 20000}, {'alpha': 3, 'max_iter': 120}, {'alpha': 3, 'max_iter': 500}, {'alpha': 3, 'max_iter': 1000}, {'alpha': 3, 'max_iter': 5000}, {'alpha': 3, 'max_iter': 10000}, {'alpha': 3, 'max_iter': 20000}, {'alpha': 4, 'max_iter': 120}, {'alpha': 4, 'max_iter': 500}, {'alpha': 4, 'max_iter': 1000}, {'alpha': 4, 'max_iter': 5000}, {'alpha': 4, 'max_iter': 10000}, {'alpha': 4, 'max_iter': 20000}, {'alpha': 7, 'max_iter': 120}, {'alpha': 7, 'max_iter': 500}, {'alpha': 7, 'max_iter': 1000}, {'alpha': 7, 'max_iter': 5000}, {'alpha': 7, 'max_iter': 10000}, {'alpha': 7, 'max_iter': 20000}, {'alpha': 10, 'max_iter': 120}, {'alpha': 10, 'max_iter': 500}, {'alpha': 10, 'max_iter': 1000}, {'alpha': 10, 'max_iter': 5000}, {'alpha': 10, 'max_iter': 10000}, {'alpha': 10, 'max_iter': 20000}], 'split0_test_score': array([0.71808862, 0.71808862, 0.71808862, 0.71808862, 0.71808862, 0.71808862, 0.71798256, 0.71798256, 0.71798256, 0.71798256, 0.71798256, 0.71798256, 0.71787656, 0.71787656, 0.71787656, 0.71787656, 0.71787656, 0.71787656, 0.71777061, 0.71777061, 0.71777061, 0.71777061, 0.71777061, 0.71777061, 0.71745313, 0.71745313, 0.71745313, 0.71745313, 0.71745313, 0.71745313, 0.71639999, 0.71639999, 0.71639999, 0.71639999, 0.71639999, 0.71639999, 0.71535668, 0.71535668, 0.71535668, 0.71535668, 0.71535668, 0.71535668, 0.71432515, 0.71432515, 0.71432515, 0.71432515, 0.71432515, 0.71432515, 0.71131135, 0.71131135, 0.71131135, 0.71131135, 0.71131135, 0.71131135, 0.70842577, 0.70842577, 0.70842577, 0.70842577, 0.70842577, 0.70842577]), 'split1_test_score': array([0.76297446, 0.76297446, 0.76297446, 0.76297446, 0.76297446, 0.76297446, 0.76305625, 0.76305625, 0.76305625, 0.76305625, 0.76305625, 0.76305625, 0.76313724, 0.76313724, 0.76313724, 0.76313724, 0.76313724, 0.76313724, 0.76321745, 0.76321745, 0.76321745, 0.76321745, 0.76321745, 0.76321745, 0.76345345, 0.76345345, 0.76345345, 0.76345345, 0.76345345, 0.76345345, 0.76419222, 0.76419222, 0.76419222, 0.76419222, 0.76419222, 0.76419222, 0.76486259, 0.76486259, 0.76486259, 0.76486259, 0.76486259, 0.76486259, 0.76547065, 0.76547065, 0.76547065, 0.76547065, 0.76547065, 0.76547065, 0.76697061, 0.76697061, 0.76697061, 0.76697061, 0.76697061, 0.76697061, 0.76806586, 0.76806586, 0.76806586, 0.76806586, 0.76806586, 0.76806586]), 'split2_test_score': array([0.79757102, 0.79757102, 0.79757102, 0.79757102, 0.79757102, 0.79757102, 0.7976316 , 0.7976316 , 0.7976316 , 0.7976316 , 0.7976316 , 0.7976316 , 0.79769118, 0.79769118, 0.79769118, 0.79769118, 0.79769118, 0.79769118, 0.79774976, 0.79774976, 0.79774976, 0.79774976, 0.79774976, 0.79774976, 0.79791969, 0.79791969, 0.79791969, 0.79791969, 0.79791969, 0.79791969, 0.79842793, 0.79842793, 0.79842793, 0.79842793, 0.79842793, 0.79842793, 0.7988571 , 0.7988571 , 0.7988571 , 0.7988571 , 0.7988571 , 0.7988571 , 0.79921862, 0.79921862, 0.79921862, 0.79921862, 0.79921862, 0.79921862, 0.79998247, 0.79998247, 0.79998247, 0.79998247, 0.79998247, 0.79998247, 0.80038996, 0.80038996, 0.80038996, 0.80038996, 0.80038996, 0.80038996]), 'split3_test_score': array([0.63149581, 0.63149581, 0.63149581, 0.63149581, 0.63149581, 0.63149581, 0.63142321, 0.63142321, 0.63142321, 0.63142321, 0.63142321, 0.63142321, 0.63134994, 0.63134994, 0.63134994, 0.63134994, 0.63134994, 0.63134994, 0.63127601, 0.63127601, 0.63127601, 0.63127601, 0.63127601, 0.63127601, 0.63105049, 0.63105049, 0.63105049, 0.63105049, 0.63105049, 0.63105049, 0.63026406, 0.63026406, 0.63026406, 0.63026406, 0.63026406, 0.63026406, 0.6294364 , 0.6294364 , 0.6294364 , 0.6294364 , 0.6294364 , 0.6294364 , 0.62857998, 0.62857998, 0.62857998, 0.62857998, 0.62857998, 0.62857998, 0.62592131, 0.62592131, 0.62592131, 0.62592131, 0.62592131, 0.62592131, 0.62323196, 0.62323196, 0.62323196, 0.62323196, 0.62323196, 0.62323196]), 'split4_test_score': array([0.57298052, 0.57298052, 0.57298052, 0.57298052, 0.57298052, 0.57298052, 0.5732857 , 0.5732857 , 0.5732857 , 0.5732857 , 0.5732857 , 0.5732857 , 0.57358984, 0.57358984, 0.57358984, 0.57358984, 0.57358984, 0.57358984, 0.57389294, 0.57389294, 0.57389294, 0.57389294, 0.57389294, 0.57389294, 0.57479608, 0.57479608, 0.57479608, 0.57479608, 0.57479608, 0.57479608, 0.57774197, 0.57774197, 0.57774197, 0.57774197, 0.57774197, 0.57774197, 0.5805933 , 0.5805933 , 0.5805933 , 0.5805933 , 0.5805933 , 0.5805933 , 0.58335545, 0.58335545, 0.58335545, 0.58335545, 0.58335545, 0.58335545, 0.59115025, 0.59115025, 0.59115025, 0.59115025, 0.59115025, 0.59115025, 0.59828008, 0.59828008, 0.59828008, 0.59828008, 0.59828008, 0.59828008]), 'split5_test_score': array([0.66144474, 0.66144474, 0.66144474, 0.66144474, 0.66144474, 0.66144474, 0.66161342, 0.66161342, 0.66161342, 0.66161342, 0.66161342, 0.66161342, 0.6617813 , 0.6617813 , 0.6617813 , 0.6617813 , 0.6617813 , 0.6617813 , 0.66194839, 0.66194839, 0.66194839, 0.66194839, 0.66194839, 0.66194839, 0.66244504, 0.66244504, 0.66244504, 0.66244504, 0.66244504, 0.66244504, 0.66405319, 0.66405319, 0.66405319, 0.66405319, 0.66405319, 0.66405319, 0.66559481, 0.66559481, 0.66559481, 0.66559481, 0.66559481, 0.66559481, 0.66707696, 0.66707696, 0.66707696, 0.66707696, 0.66707696, 0.66707696, 0.67122128, 0.67122128, 0.67122128, 0.67122128, 0.67122128, 0.67122128, 0.67499632, 0.67499632, 0.67499632, 0.67499632, 0.67499632, 0.67499632]), 'split6_test_score': array([0.62262903, 0.62262903, 0.62262903, 0.62262903, 0.62262903, 0.62262903, 0.62251311, 0.62251311, 0.62251311, 0.62251311, 0.62251311, 0.62251311, 0.62239734, 0.62239734, 0.62239734, 0.62239734, 0.62239734, 0.62239734, 0.62228173, 0.62228173, 0.62228173, 0.62228173, 0.62228173, 0.62228173, 0.62193582, 0.62193582, 0.62193582, 0.62193582, 0.62193582, 0.62193582, 0.62079249, 0.62079249, 0.62079249, 0.62079249, 0.62079249, 0.62079249, 0.61966359, 0.61966359, 0.61966359, 0.61966359, 0.61966359, 0.61966359, 0.61854845, 0.61854845, 0.61854845, 0.61854845, 0.61854845, 0.61854845, 0.61527964, 0.61527964, 0.61527964, 0.61527964, 0.61527964, 0.61527964, 0.61211484, 0.61211484, 0.61211484, 0.61211484, 0.61211484, 0.61211484]), 'split7_test_score': array([0.68670216, 0.68670216, 0.68670216, 0.68670216, 0.68670216, 0.68670216, 0.68665012, 0.68665012, 0.68665012, 0.68665012, 0.68665012, 0.68665012, 0.6865982 , 0.6865982 , 0.6865982 , 0.6865982 , 0.6865982 , 0.6865982 , 0.68654639, 0.68654639, 0.68654639, 0.68654639, 0.68654639, 0.68654639, 0.68639168, 0.68639168, 0.68639168, 0.68639168, 0.68639168, 0.68639168, 0.68588364, 0.68588364, 0.68588364, 0.68588364, 0.68588364, 0.68588364, 0.68538731, 0.68538731, 0.68538731, 0.68538731, 0.68538731, 0.68538731, 0.68490249, 0.68490249, 0.68490249, 0.68490249, 0.68490249, 0.68490249, 0.68351356, 0.68351356, 0.68351356, 0.68351356, 0.68351356, 0.68351356, 0.68221399, 0.68221399, 0.68221399, 0.68221399, 0.68221399, 0.68221399]), 'split8_test_score': array([0.60004148, 0.60004148, 0.60004148, 0.60004148, 0.60004148, 0.60004148, 0.60038207, 0.60038207, 0.60038207, 0.60038207, 0.60038207, 0.60038207, 0.60072071, 0.60072071, 0.60072071, 0.60072071, 0.60072071, 0.60072071, 0.6010574 , 0.6010574 , 0.6010574 , 0.6010574 , 0.6010574 , 0.6010574 , 0.60205607, 0.60205607, 0.60205607, 0.60205607, 0.60205607, 0.60205607, 0.60526768, 0.60526768, 0.60526768, 0.60526768, 0.60526768, 0.60526768, 0.60831326, 0.60831326, 0.60831326, 0.60831326, 0.60831326, 0.60831326, 0.61120898, 0.61120898, 0.61120898, 0.61120898, 0.61120898, 0.61120898, 0.61912366, 0.61912366, 0.61912366, 0.61912366, 0.61912366, 0.61912366, 0.62607827, 0.62607827, 0.62607827, 0.62607827, 0.62607827, 0.62607827]), 'split9_test_score': array([0.69431645, 0.69431645, 0.69431645, 0.69431645, 0.69431645, 0.69431645, 0.69441855, 0.69441855, 0.69441855, 0.69441855, 0.69441855, 0.69441855, 0.69451927, 0.69451927, 0.69451927, 0.69451927, 0.69451927, 0.69451927, 0.69461863, 0.69461863, 0.69461863, 0.69461863, 0.69461863, 0.69461863, 0.69490882, 0.69490882, 0.69490882, 0.69490882, 0.69490882, 0.69490882, 0.69579743, 0.69579743, 0.69579743, 0.69579743, 0.69579743, 0.69579743, 0.69658024, 0.69658024, 0.69658024, 0.69658024, 0.69658024, 0.69658024, 0.69727384, 0.69727384, 0.69727384, 0.69727384, 0.69727384, 0.69727384, 0.69894208, 0.69894208, 0.69894208, 0.69894208, 0.69894208, 0.69894208, 0.70016848, 0.70016848, 0.70016848, 0.70016848, 0.70016848, 0.70016848]), 'mean_test_score': array([0.67482443, 0.67482443, 0.67482443, 0.67482443, 0.67482443, 0.67482443, 0.67489566, 0.67489566, 0.67489566, 0.67489566, 0.67489566, 0.67489566, 0.67496616, 0.67496616, 0.67496616, 0.67496616, 0.67496616, 0.67496616, 0.67503593, 0.67503593, 0.67503593, 0.67503593, 0.67503593, 0.67503593, 0.67524103, 0.67524103, 0.67524103, 0.67524103, 0.67524103, 0.67524103, 0.67588206, 0.67588206, 0.67588206, 0.67588206, 0.67588206, 0.67588206, 0.67646453, 0.67646453, 0.67646453, 0.67646453, 0.67646453, 0.67646453, 0.67699606, 0.67699606, 0.67699606, 0.67699606, 0.67699606, 0.67699606, 0.67834162, 0.67834162, 0.67834162, 0.67834162, 0.67834162, 0.67834162, 0.67939655, 0.67939655, 0.67939655, 0.67939655, 0.67939655, 0.67939655]), 'std_test_score': array([0.06780515, 0.06780515, 0.06780515, 0.06780515, 0.06780515, 0.06780515, 0.06774899, 0.06774899, 0.06774899, 0.06774899, 0.06774899, 0.06774899, 0.06769324, 0.06769324, 0.06769324, 0.06769324, 0.06769324, 0.06769324, 0.06763789, 0.06763789, 0.06763789, 0.06763789, 0.06763789, 0.06763789, 0.06747423, 0.06747423, 0.06747423, 0.06747423, 0.06747423, 0.06747423, 0.06695385, 0.06695385, 0.06695385, 0.06695385, 0.06695385, 0.06695385, 0.06647033, 0.06647033, 0.06647033, 0.06647033, 0.06647033, 0.06647033, 0.06602151, 0.06602151, 0.06602151, 0.06602151, 0.06602151, 0.06602151, 0.06486465, 0.06486465, 0.06486465, 0.06486465, 0.06486465, 0.06486465, 0.06395868, 0.06395868, 0.06395868, 0.06395868, 0.06395868, 0.06395868]), 'rank_test_score': array([55, 55, 55, 55, 55, 55, 49, 49, 49, 49, 49, 49, 43, 43, 43, 43, 43, 43, 37, 37, 37, 37, 37, 37, 31, 31, 31, 31, 31, 31, 25, 25, 25, 25, 25, 25, 19, 19, 19, 19, 19, 19, 13, 13, 13, 13, 13, 13, 7, 7, 7, 7, 7, 7, 1, 1, 1, 1, 1, 1])}21.032677038830798
学习地址:
黑马程序员3天快速入门python机器学习_哔哩哔哩_bilibili