Skip to main content
 首页 » 编程设计

python之scikit-learn fit 剩余时间

2025年05月04日17davidwang456

有没有办法估计拟合模型时的剩余时间?例如

model = sk.ensemble.RandomForestRegressor(n_estimators=10) 
model.fit(x, y) 

我有一个相当大的数据集(数百万行),这将需要一些时间,所以我想知道估计时间,以便我可以做其他事情并在过程完成后返回。

对于像随机森林这样的集成,剩余时间的估计应该[相当]容易。

请您参考如下方法:

试试 verbose 选项。您可以将其更改为 0(无输出)、1(每个作业更新)和 2(每个树更新),例如

model = RandomForestRegressor(n_estimators=100, verbose=2, n_jobs=2).fit(X_train, y_train)