基于LightGBM的饭店流量分析(模型构建与预测)
发布时间
阅读量:
阅读量
接续前文内容:
<LightGBM预测饭店流量1: 数据处理>
LIghtGBM模型构建
- model_selection.KFold()
K折交叉验证是一种数据划分方法,其核心在于将原始的训练与测试数据集分割为n_splits个互不重叠的子集。在每次迭代过程中,选取其中一个子集作为验证集,其余n_splits-1个子集则共同构成训练集。通过重复这一过程n_splits次,最终可获得n_splits组独立的训练与测试结果。
import numpy as np
import pandas as pd
import lightgbm as lgbm
from sklearn import metrics
from sklearn import model_selection
np.random.seed(42)
model = lgbm.LGBMRegressor(objective='regression', max_depth=5, num_leaves=25, learning_rate=0.007,
n_estimators=1000, min_child_samples=80, subsample=0.8, colsample_bytr
全部评论 (0)
还没有任何评论哟~
