Truth Generator with particular distribution

Uniform distribution

class embedded_voting.TruthGeneratorUniform(minimum_value=10, maximum_value=20, seed=42)[source]

A uniform generator for the ground truth (“true value”) of each candidate.

The true value of each candidate is independent and uniform in [minimum_value, maximum_value].

Parameters:
  • minimum_value (Number) – The minimum true value of a candidate.
  • maximum_value (Number) – The maximum true value of a candidate.

Examples

>>> np.random.seed(42)
>>> truth_generator = TruthGeneratorUniform(minimum_value=10, maximum_value=20)
>>> truth_generator(n_candidates=3)
array([17.73956049, 14.3887844 , 18.5859792 ])

Normal distribution

class embedded_voting.TruthGeneratorNormal(center=15, noise=5)[source]

A normal generator for the ground truth (“true value”) of each candidate.

The true value of each candidate is independent and follow a Gaussian distribution with mean center and standard deviation noise.

Parameters:
  • center (float) – The mean of the Gaussian distribution.
  • noise (float) – The standard deviation of the Gaussian distribution.

Examples

>>> np.random.seed(42)
>>> truth_generator = TruthGeneratorNormal(center=15, noise=5)
>>> truth_generator(n_candidates=3)
array([17.48357077, 14.30867849, 18.23844269])