Moving Voter Analysis

class embedded_voting.MovingVoter(embeddings=None, moving_voter=0)[source]

This subclass of Embeddings can be used to see what happen to the scores of the different candidates when a voter moves from a group to another.

There is 4 candidates and 3 groups: Each group strongly support one of the candidate and dislike the other candidates, except the last candidate which is fine for every group.

The moving voter is a voter that do not have any preference between the candidates (she gives a score of 0.8 to every candidate, except 0.5 for the last one), but her embeddings move from one position to another.

Parameters:
  • embeddings (Embeddings) – The embeddings of the voters. If none is specified, embeddings are the identity matrix.
  • moving_voter (int) – The index of the voter that is moving
rule

The rule we are using in the election.

Type:Rule
moving_voter

The index of the voter that is moving.

Type:int
ratings_

The ratings given by the voters to the candidates

Type:np.ndarray

Examples

>>> moving_profile = MovingVoter()
>>> moving_profile(RuleSumRatings())  # DOCTEST: +ELLIPSIS
<embedded_voting.experiments.moving_voter.MovingVoter object at ...>
>>> moving_profile.moving_voter
0
>>> moving_profile.embeddings
Embeddings([[1., 0., 0.],
            [0., 0., 1.],
            [0., 1., 0.],
            [1., 0., 0.]])
>>> moving_profile.ratings_
Ratings([[0.8, 0.8, 0.8, 0.5],
         [0.1, 0.1, 1. , 0.5],
         [0.1, 1. , 0.1, 0.5],
         [1. , 0.1, 0.1, 0.5]])
plot_features_evolution(show=True)[source]

This function plot the evolution of the features of the candidates when the moving voters’ embeddings are changing. Only works for RuleSVDMax and RuleFeatures.

Parameters:show (bool) – If True, displays the figure at the end of the function.

Examples

>>> p = MovingVoter()(RuleSVDMax())
>>> p.plot_features_evolution(show=False)
plot_scores_evolution(show=True)[source]

This function plot the evolution of the scores of the candidates when the moving voters’ embeddings are changing.

Parameters:show (bool) – If True, displays the figure at the end of the function.

Examples

>>> p = MovingVoter()(RuleSVDNash())
>>> p.plot_scores_evolution(show=False)