コード例 #1
0
print('Standard Deviations = ', scaler.scale_)

## Modeling and Predictions

# L1_cv
l1_cv = LassoCV(cv=5, max_iter=10000)
#100 Regularization coefficients evenly spaced between 0.1 and 1000
l1_cv.alphas = tuple(np.linspace(0.1, 1000, 100))
l1_cv.fit(train, y_train)
res_l1 = l1_cv.predict(test)
print(res_l1)

# L2_cv
l2_cv = RidgeCV(cv=None, store_cv_values=True)
#100 Regularization coefficients evenly spaced between 0.1 and 1000
l2_cv.alphas = tuple(np.linspace(0.1, 10000, 100))
l2_cv.fit(train, y_train)
res_l2 = l2_cv.predict(test)

print(res_l2)

# res_xgb
model_xgb = xgb.XGBRegressor(colsample_bytree=0.2,
                             gamma=0.0,
                             learning_rate=0.05,
                             max_depth=6,
                             min_child_weight=1.5,
                             n_estimators=7200,
                             reg_alpha=0.9,
                             reg_lambda=0.6,
                             subsample=0.2,