是否可以在代码中使用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'

最佳答案

使用n_jobs参数实现:

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

关于python - 使用Python Tpot配置njobs,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/46977794/

10-15 23:00