mlresearch.utils.parallel_loop

mlresearch.utils.parallel_loop(function, iterable, n_jobs=None, progress_bar=False, description=None)[source]

Parallelize a loop and optionally add a progress bar.

Warning

The progress bar tracks job starts, not completions.

Parameters:
functionfunction

The function to which the elements in the iterable will passed to. Must have a single parameter.

iterableiterable

Object to be looped over.

n_jobsint, default=None

Number of jobs to run in parallel. None means 1 unless in a joblib.parallel_backend context. -1 means using all processors.

Returns:
outputlist

The list with the results produced using function across iterable.