check_n_jobs

check_n_jobs(n_jobs: int) int[source]

Check n_jobs parameter according to the scikit-learn convention.

https://scikit-learn.org/stable/glossary.html#term-n_jobs

Parameters:
n_jobsint or None

The number of jobs for parallelization. If None or 0, 1 is used. If negative, (n_cpus + 1 + n_jobs) is used. In such a case, -1 would use all available CPUs and -2 would use all but one. If the number of CPUs used would fall under 1, 1 is returned instead.

Returns:
n_jobsint

The number of threads to be used.