선형 회귀
학습 목표
- 선형 회귀의 구현 과정에서 소유권
- 응용 선형 회귀 또는 SGDRegressor 회귀 예측을 달성
- 우리는 평가 기준을 알고 공식 회귀 알고리즘
- 단순성과 원인과 해결책을 알고 Overfitting
- 우리는 원칙 능선 회귀 및 선형 회귀 차이를 알고
- 응용 릿지 회귀 예측을 달성
- 응용 프로그램 저장 및로드 모델을 달성 JOBLIB
저장 및 2.11 모델의로드
![그림 삽입 설명 여기](https://img-blog.csdnimg.cn/2020030322260867.png)
저장 및 로딩 API 1 sklearn 모델
- sklearn.externals 수입 JOBLIB에서
- 저장 : joblib.dump (추정, 'test.pkl')
- 로드 : 추정 = joblib.load ( 'test.pkl')
로드 케이스를 저장하는 2 선형 회귀 모델
def load_dump_demo():
"""
线性回归:岭回归
:return:
"""
data = load_boston()
x_train, x_test, y_train, y_test = train_test_split(data.data, data.target, random_state=22)
transfer = StandardScaler()
x_train = transfer.fit_transform(x_train)
x_test = transfer.fit_transform(x_test)
estimator = joblib.load("./data/test.pkl")
y_predict = estimator.predict(x_test)
print("预测值为:\n", y_predict)
print("模型中的系数为:\n", estimator.coef_)
print("模型中的偏置为:\n", estimator.intercept_)
error = mean_squared_error(y_test, y_predict)
print("误差为:\n", error)