0
点赞
收藏
分享

微信扫一扫

训练随机森林回归模型 RandomForestRegressor


训练随机森林回归模型 RandomForestRegressor

bootstrap 表示是够有放回抽样,还是不放回抽样

# 训练随机森林回归模型 RandomForestRegressor
from sklearn.ensemble import RandomForestRegressor
from sklearn import datasets

boston = datasets.load_boston()
features = boston.data[:, 0:2]
target = boston.target
# 训练模型 bootstrap 表示是够有放回抽样,还是不放回抽样
randomforest = RandomForestRegressor(random_state=0, n_jobs=-1)
model = randomforest.fit(features, target)


举报

相关推荐

0 条评论