EL之Boosting之GB(DTR):简单回归问题使用梯度提升法(DIY数据集+DTR模型+调两参)
生活随笔
收集整理的這篇文章主要介紹了
EL之Boosting之GB(DTR):简单回归问题使用梯度提升法(DIY数据集+DTR模型+调两参)
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
EL之Boosting之GB(DTR):簡單回歸問題使用梯度提升法(DIY數據集+DTR模型+調兩參)
?
?
目錄
輸出結果
設計思路
核心代碼
?
?
輸出結果
1、eps=0.1,treeDepth=1
2、eps=0.1,treeDepth=5
2、eps=0.3,treeDepth=5
設計思路
?
核心代碼
for iTrees in range(numTreesMax):modelList.append(DecisionTreeRegressor(max_depth=treeDepth))modelList[-1].fit(xTrain, residuals)latestInSamplePrediction = modelList[-1].predict(xTrain)residuals = [residuals[i] - eps * latestInSamplePrediction[i] for i in range(len(residuals))]latestOutSamplePrediction = modelList[-1].predict(xTest)predList.append(list(latestOutSamplePrediction))mse = [] allPredictions = [] for iModels in range(len(modelList)):prediction = []for iPred in range(len(xTest)):prediction.append(sum([predList[i][iPred] for i in range(iModels + 1)]) * eps)allPredictions.append(prediction)errors = [(yTest[i] - prediction[i]) for i in range(len(yTest))]mse.append(sum([e * e for e in errors]) / len(yTest))?
?
?
總結
以上是生活随笔為你收集整理的EL之Boosting之GB(DTR):简单回归问题使用梯度提升法(DIY数据集+DTR模型+调两参)的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: EL之Bagging:利用Bagging
- 下一篇: EL之Boosting之GB(DTR):