GeneratorProfileNoise#
- class svvamp.GeneratorProfileNoise(base_profile, relative_noise=0.0, absolute_noise=0.0, exponential_noise=False, sort_voters=False)[source]#
Profile generator adding noise to a given profile
- Parameters:
base_profile (Profile) – The initial profile.
relative_noise (number) – The relative noise.
absolute_noise (number) – The absolute noise
exponential_noise (bool) – If True, the noise for each candidate follows an exponential distribution whose parameter is proportional to its plurality score in the base profile. If False, the noise is uniform.
Notes
We compute
total_noise = absolute_noise + relative_noise * amplitude, whereamplitudeis the difference between the lowest and the highest utility. Then to eachpreferences_ut[v, c], a random noise is added which is drawn independently and uniformly in the interval[- total_noise, total_noise].If exponential_noise is True, the noise added to each candidate c for each voter v is drawn independently from an exponential distribution with scale parameter proportional to the plurality score of c in the base profile.
Examples
>>> generator = GeneratorProfileNoise(base_profile=Profile(preferences_ut=[[5, 1, 2], [4, 10, 1]]), ... absolute_noise=.1) >>> profile = generator() >>> profile.preferences_rk.shape (2, 3)
With an exponential noise:
>>> generator = GeneratorProfileNoise(base_profile=Profile(preferences_ut=[[5, 1, 2], [4, 10, 1]]), ... absolute_noise=.1, exponential_noise=True) >>> profile = generator() >>> profile.preferences_rk.shape (2, 3)