monte_carlo_batch#

actinvoting.monte_carlo_batch(session, ns, n_samples, n_jobs=1, file_name=None, force_recompute=False)[source]#

Estimate probabilities using the Monte Carlo method for a list of values of n.

Parameters:
  • session (WorkingSession) – The working session specifying the culture and the parameters of the model.

  • ns (list of int) – The list of values of n (number of voters) for which the values of the probability are to be estimated using the Monte Carlo method.

  • n_samples (int) – The number of samples to be used for each Monte Carlo estimation.

  • n_jobs (int) – The number of parallel jobs to run. If n_jobs=1, the computation is done in a single process.

  • file_name (str) – The name of the file where the result is saved. If None, the file name is automatically generated.

  • force_recompute (bool) – If True, the computation is done even if the file already exists.

Returns:

The list of estimated probabilities for the values of n in the input list.

Return type:

list of float