版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/qq_41185868/article/details/86377011
EL之GB(GBM):利用GB对(鲍鱼物理指标)回归(性别属性编码)问题(整数值年龄预测)建模
输出结果
设计思路
核心代码
#T1
nEst = 2000
depth = 5
learnRate = 0.003
maxFeatures = None
subsamp = 0.5
#T2
# nEst = 2000
# depth = 5
# learnRate = 0.005
# maxFeatures = 3
# subsamp = 0.5
abaloneGBMModel = ensemble.GradientBoostingRegressor(n_estimators=nEst, max_depth=depth,
learning_rate=learnRate, max_features=maxFeatures,
subsample=subsamp, loss='ls')
abaloneGBMModel.fit(xTrain, yTrain)
# compute mse on test set
msError = []
predictions = abaloneGBMModel._staged_decision_function(xTest)
for p in predictions:
msError.append(mean_squared_error(yTest, p))