例如:
params = {'n_estimators': 200, "max_depth": 4, 'subsample': 1, 'learning_rate': 0.1}
boost = ensemble.GradientBoostingRegressor(**params)
ghostBoost = ensemble.GradientBoostingRegressor(**params)
...
boost.fit(x, y)
ghostBoost.fit(x, y)
...
predictionA = boost.predict(features)
predictionB = ghostBoost.predict(features)
boost
和ghostBoost
完全相同,但是predictionA
不等于{
尝试将两个模型的
random_state
构造函数参数修复为相同的值。决策树构建过程是随机的,因为每个节点考虑从可用特性中随机抽取max_features
(有替换没有替换)。在编辑:特征采样不进行替换。当}时,顺序会发生变化,并且目标变量具有非唯一值,从而导致最佳特征拆分。在
max_features=None
(默认值)时,所有特征都会被计算,但是,当max_depth
不是{相关问题 更多 >
编程相关推荐