使用Python tpot配置njobs

时间:2017-10-27 14:47:11

标签: python python-3.x scikit-learn tpot

可以在代码中使用tpot配置njobs参数,而不是作为命令行参数传递吗?

阅读https://rhiever.github.io/tpot/using/州:

-njobs  NUM_JOBS    Any positive integer or -1  Number of CPUs for evaluating pipelines in parallel during the TPOT optimization process. 

Assigning this to -1 will use as many cores as available on the computer.

但如何在代码中配置此参数?

尝试:

TPOTClassifier(generations=5, verbosity=3,  config_dict='TPOT light' , NUM_JOBS = 4)  

返回错误:

TPOTClassifier(generations=5, verbosity=3,  config_dict='TPOT light' , NUM_JOBS = 4)
TypeError: __init__() got an unexpected keyword argument 'NUM_JOBS'

1 个答案:

答案 0 :(得分:1)

使用n_jobs参数:

实现

TPOTClassifier(代数= 5,详细程度= 3,config_dict =' TPOT灯',n_jobs = 4)