Votekit

Latest version: v2.0.0

Safety actively analyzes 625951 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

1.1.1

Added
- Add print statement to `BallotGraph` so that when you draw the graph without labels, it prints a dictionary of candidate labels for you.
- Add an IRV election class, which is just a wrapper for STV with 1 seat.
- Add default option to Borda election class, so users do not have to input a score vector if they want to use the traditional Borda vector.
- Add several methods to `PairwiseComparisonGraph`. Added two boolean methods that return True if there is a condorcet winner or if there is a condorcet cycle. Added two get methods that return the winner or the cycles. Cached the results of `dominating_tiers` and `get_condorcet_cycles`.

- Added optional to_float method to `first_place_votes` if users want to see them as floats instead of Fractions.
- Added a `by_bloc` parameter to `generate_profile`. If True, this returns a tuple, the first entry of which is a dictionary of PreferenceProfiles by bloc. The second entry is the aggregated profile. This is very helpful for analyzing the behavior of a single bloc of voters. Defaults to False for backwards compatibility.
- Created a `Cumulative` ballot generator class. The `Cumulative` class works like PL, but samples with replacement instead of without. The ranking order does not matter here, simply that candidates are listed on the ballot with multiplicity.
- Created a `HighestScore` election class. This takes in a profile and a score vector, and returns the candidates with highest scores. There is a lot of flexibility in the score vector, so this class can run things like Borda, cumulative, etc.
- Created a `Cumulative` election class which is just a subclass of `HighestScore` with the score vector set to all 1s. Thus anyone appearing on the ballot gets one point for each time they appear.
- Wrote an `__add__` method for `PreferenceProfile` that combines the ballot lists of two profiles.
- Created utility functions to compute the winners of a profile given a score vector, as well as to validate a score vector (non-negative and non-increasing).
- Created a `shortPlackettLuce` class which allows you to generate ballots of arbitrary length in the style of PL.
- Added tests for `__add__` method of `PreferenceProfile`.
- Added `SlatePreference` model and tests.

Changed
- Change the way the `condense_ballots()` method works in profiles. Rather than altering the original profile, it returns a new profile. This gives users the option to preserve the original profile.

- Alter `STV` class so that the remaining candidates are always listed in order of current first place votes.

- Made `PlackettLuce` a subclass of `shortPlackettLuce`.

Fixed
- Fixed an error in the `PreferenceProfile` tail method.

1.1.0

1.0.2

1.0.1

1.0.0

Links

Releases

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.