Ratings

class embedded_voting.Ratings[source]

Ratings of the voters in a given election.

Parameters:ratings (list, np.ndarray or Ratings) – The ratings given by each voter to each candidate.
n_voters

The number of voters.

Type:int
n_candidates

The number of candidates.

Type:int

Examples

>>> ratings = Ratings([[1, .8, .5], [.3, .5, .9]])
>>> ratings
Ratings([[1. , 0.8, 0.5],
         [0.3, 0.5, 0.9]])
>>> ratings.n_voters
2
>>> ratings.n_candidates
3
>>> ratings.voter_ratings(0)
array([1. , 0.8, 0.5])
>>> ratings.candidate_ratings(0)
array([1. , 0.3])