Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

How to pass args to skopt, like n_jobs for multiprocessing? #276

Answered by kernc
crazy25000 asked this question in Q&A
Discussion options

Hi,

How can we pass arguments to skopt when using method='skopt' with backtest.optimize? Would like to update n_jobs because the default is 1.

Tried passing it as a keyword arg, but does not work: bt.optimize(p1=range(20, 50, 10), p2=range(50, 100, 10), maximize='Profit Factor', constraint=lambda param: param.p1 < param.p2, method='skopt', n_jobs=15)

https://scikit-optimize.github.io/stable/modules/generated/skopt.optimizer.forest_minimize.html#skopt.optimizer.forest_minimize

n_jobs int, default: 1
The number of jobs to run in parallel for fit and predict. If -1, then the number of jobs is set to the number of cores.

Thank you,

You must be logged in to vote

Tried passing it as a keyword arg, but does not work

It doesn't work if it's not implemented in the source.

Additional keyword arguments represent strategy arguments with
list-like collections of possible values. For example, the following
code finds and returns the "best" of the 7 admissible (of the
9 possible) parameter combinations:
backtest.optimize(sma1=[5, 10, 15], sma2=[10, 20, 40],

Passing n_jobs != 1 won't help you; n_jobs= in scikit-optimize is only used for building the hyperspace landscape estimators, not for running the comparably likely more expensive ob...

Replies: 1 comment 1 reply

Comment options

Tried passing it as a keyword arg, but does not work

It doesn't work if it's not implemented in the source.

Additional keyword arguments represent strategy arguments with
list-like collections of possible values. For example, the following
code finds and returns the "best" of the 7 admissible (of the
9 possible) parameter combinations:
backtest.optimize(sma1=[5, 10, 15], sma2=[10, 20, 40],

Passing n_jobs != 1 won't help you; n_jobs= in scikit-optimize is only used for building the hyperspace landscape estimators, not for running the comparably likely more expensive objective function. Scikit-optimize does iterative model-based optimization, and you get your time back in terms of fewer and more intelligent hyperspace point evaluations.

Don't just believe me; try it for yourself:

res = forest_minimize(
You must be logged in to vote
1 reply
Comment options

n_jobs= in scikit-optimize is only used for building the hyperspace landscape estimators, not for running the comparably likely more expensive objective function.

Oo did not know that. I ran a quick preliminary test earlier, but only looked at number of CPUs used vs. If it actually sped up the computations. I didn't see it in their documentation either. Thanks for the help again!

Answer selected by crazy25000
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants

AltStyle によって変換されたページ (->オリジナル) /