我对API docs is that n_jobs
should control the number of threads that is started by the fit()
and predict()
methods的理解。我的笔记本电脑(MacBook Pro四核i7)确实是这种情况,但是当我在具有2个14核Xeon CPU的Linux服务器上运行相同的代码时,我可以看到python进程正在生成数百个线程。有什么事吗?
def getRFClassifier():
return RandomForestClassifier(n_estimators=args.ntrees, min_samples_leaf=10, n_jobs=args.nthreads, class_weight="balanced_subsample")
我有ntrees=1000
和nthreads=-2
(我也尝试过-1并将其数目减少到20),我仍然得到比预期更多的方法。
我可能会丢失任何东西吗?