EL之RF(RFR):利用RandomForestRegressor对回归问题(实数值评分预测)建模(调2参)
EL之RF(RFR):利用RandomForestRegressor对回归问题(实数值评分预测)建模(调2参)
输出结果
设计思路
核心代码
mseOos = []
nTreeList = range(100, 1000, 100) #----▲☆▲☆▲
for iTrees in nTreeList:
# depth = None
# depth=6 #----▲▲▲▲▲
depth=10 #----☆☆☆☆
maxFeat = 4 #try tweaking
wineRFModel = ensemble.RandomForestRegressor(n_estimators=iTrees, max_depth=depth, max_features=maxFeat,
oob_score=False, random_state=531)
wineRFModel.fit(xTrain,yTrain)
prediction = wineRFModel.predict(xTest)
mseOos.append(mean_squared_error(yTest, prediction))
赞 (0)