Fast Rules¶
Fast¶
-
class
embedded_voting.
RuleFast
(embeddings_from_ratings=None, f=None, aggregation_rule=<function prod>)[source]¶ Voting rule in which the aggregated score of a candidate is based on singular values of his score matrix.
Parameters: - embeddings_from_ratings (EmbeddingsFromRatingsCorrelation) – If no embeddings are specified in the call, this EmbeddingsFromRatings object is use to generate the embeddings from the ratings. Default: EmbeddingsFromRatingsCorrelation(preprocess_ratings=center_and_normalize).
- f (callable) – The transformation for the ratings given by each voter. Input : (ratings_v: np.ndarray, history_mean: Number, history_std: Number). Output : modified_ratings_v: np.ndarray.
- aggregation_rule (callable) – The aggregation rule for the singular values. Input : list of float. Output : float. By default, it is the product of the singular values.
Examples
>>> ratings = np.array([[.5, .6, .3], [.7, 0, .2], [.2, 1, .8]]) >>> election = RuleFast()(ratings) >>> election.ranking_ [1, 0, 2] >>> election.winner_ 1
Variants¶
-
class
embedded_voting.
RuleFastNash
(embeddings_from_ratings=None, f=None)[source]¶ Voting rule in which the aggregated score of a candidate is the product of the important singular values of his score matrix.
Parameters: - embeddings_from_ratings (EmbeddingsFromRatingsCorrelation) – If no embeddings are specified in the call, this EmbeddingsFromRatings object is use to generate the embeddings from the ratings. Default: EmbeddingsFromRatingsCorrelation(preprocess_ratings=center_and_normalize).
- f (callable) – The transformation for the ratings given by each voter. Input : (ratings_v: np.ndarray, history_mean: Number, history_std: Number). Output : modified_ratings_v: np.ndarray.
Examples
>>> ratings = np.array([[.5, .6, .3], [.7, 0, .2], [.2, 1, .8]]) >>> election = RuleFastNash()(ratings) >>> election.ranking_ [1, 0, 2] >>> election.winner_ 1
-
class
embedded_voting.
RuleFastSum
(embeddings_from_ratings=None, f=None)[source]¶ Voting rule in which the aggregated score of a candidate is the sum of the important singular values of his score matrix.
Parameters: - embeddings_from_ratings (EmbeddingsFromRatingsCorrelation) – If no embeddings are specified in the call, this EmbeddingsFromRatings object is use to generate the embeddings from the ratings. Default: EmbeddingsFromRatingsCorrelation(preprocess_ratings=center_and_normalize).
- f (callable) – The transformation for the ratings given by each voter. Input : (ratings_v: np.ndarray, history_mean: Number, history_std: Number). Output : modified_ratings_v: np.ndarray.
Examples
>>> ratings = np.array([[.5, .6, .3], [.7, 0, .2], [.2, 1, .8]]) >>> election = RuleFastSum()(ratings) >>> election.ranking_ [1, 0, 2] >>> election.winner_ 1
-
class
embedded_voting.
RuleFastMin
(embeddings_from_ratings=None, f=None)[source]¶ Voting rule in which the aggregated score of a candidate is the minimum of the important singular values of his score matrix.
Parameters: - embeddings_from_ratings (EmbeddingsFromRatingsCorrelation) – If no embeddings are specified in the call, this EmbeddingsFromRatings object is use to generate the embeddings from the ratings. Default: EmbeddingsFromRatingsCorrelation(preprocess_ratings=center_and_normalize).
- f (callable) – The transformation for the ratings given by each voter. Input : (ratings_v: np.ndarray, history_mean: Number, history_std: Number). Output : modified_ratings_v: np.ndarray.
Examples
>>> ratings = np.array([[.5, .6, .3], [.7, 0, .2], [.2, 1, .8]]) >>> election = RuleFastMin()(ratings) >>> election.ranking_ [1, 0, 2] >>> election.winner_ 1
-
class
embedded_voting.
RuleFastLog
(embeddings_from_ratings=None, f=None)[source]¶ Voting rule in which the aggregated score of a candidate is the log sum of the important singular values of his score matrix.
Parameters: - embeddings_from_ratings (EmbeddingsFromRatingsCorrelation) – If no embeddings are specified in the call, this EmbeddingsFromRatings object is use to generate the embeddings from the ratings. Default: EmbeddingsFromRatingsCorrelation(preprocess_ratings=center_and_normalize).
- f (callable) – The transformation for the ratings given by each voter. Input : (ratings_v: np.ndarray, history_mean: Number, history_std: Number). Output : modified_ratings_v: np.ndarray.
Examples
>>> ratings = np.array([[.5, .6, .3], [.7, 0, .2], [.2, 1, .8]]) >>> election = RuleFastLog()(ratings) >>> election.ranking_ [1, 0, 2] >>> election.winner_ 1