岭回归
正则化力度也是一个需要调参的过程
模型的保存与加载
api:sklearn.externals.joblib
保存:joblib.dump
加载:joblib.load
注意:文件格式:pkl,是一种二进制文件
"""案例:波士顿房价"""
from sklearn.datasets import load_boston
from sklearn.linear_model import Ridge
from sklearn.model_selection import train_test_split
from sklearn.preprocessing import StandardScaler
from sklearn.metrics import mean_squared_error
def myridge():
"""
岭回归直接预测房子价格
:return: None
"""
#获取数据
lb = load_boston()
#分割数据到训练集和测试集
x_train, x_test, y_train, y_test = train_test_split(lb.data, lb.target, test_size