class svvamp.GeneratorProfilePerturbedCulture(n_v, theta, n_c=None, ranking=None, sort_voters=False)[source]

Profile generator using the ‘Perturbed Culture’ model.

Parameters:
  • n_v (int) – Number of voters.

  • theta (float) – Weight of the unanimous part.

  • n_c (int, optional) – Number of candidates.

  • ranking (List, optional) – This will be the ranking of all the voters of the unanimous part. If not specified, it is drawn at random each time a profile is generated.

  • sort_voters (bool) – This argument is passed to Profile (but since voters are identical, there is no advantage in using True).

Notes

First, if ranking is not specified, it is drawn uniformly at random. Then, independently for each voter:

  • With probability theta, she has the ranking ranking (“unanimous part” of the profile).

  • With probability 1 - theta, her ranking is drawn uniformly at random (“impartial culture” part of the profile).

Examples

>>> generator = GeneratorProfilePerturbedCulture(n_v=10, theta=.1, n_c=3)
>>> profile = generator()
>>> profile.preferences_rk.shape
(10, 3)
>>> generator = GeneratorProfilePerturbedCulture(n_v=10, theta=.1, ranking=[0, 1, 2])
>>> profile = generator()
>>> profile.preferences_rk.shape
(10, 3)
>>> generator = GeneratorProfilePerturbedCulture(n_v=10, theta=.1)
Traceback (most recent call last):
ValueError: GeneratorProfilePerturbedCulture: You should specify `n_c` or `ranking`.