navlie.utils.common.monte_carlo¶
- navlie.utils.common.monte_carlo(trial: Callable[[int], GaussianResultList], num_trials: int, num_jobs: int = -1, verbose: int = 10) → MonteCarloResult¶
Monte-Carlo experiment executor. Give a callable
trial
function that executes a trial and returns aGaussianResultList
, and this function will execute it a number of times and aappgregate the results.- Parameters:
trial (Callable[[int], GaussianResultList]) – Callable trial function. Must accept a single integer trial number, and return a GaussianResultList. From trial to trial, the timestamps are expected to remain consistent.
num_trials (int) – Number of Trials to execute
num_jobs (int, optional) – The maximum number of concurrently running jobs, by default -1. If -1 all CPUs are used. If 1 is given, no parallel computing code is used at all, which is useful for debugging. For num_jobs below -1, (n_cpus + 1 + num_jobs) are used. Thus for num_jobs = -2, all CPUs but one are used.
verbose (int, optional) – The verbosity level, by default 10. If non zero, progress messages are printed. Above 50, the output is sent to stdout. The frequency of the messages increases with the verbosity level. If it more than 10, all iterations are reported.
- Returns:
Data container object
- Return type: