Skip to content

Commit

Permalink
add citation to JOSS paper
Browse files Browse the repository at this point in the history
  • Loading branch information
epacuit committed Feb 5, 2025
1 parent c49806b commit a7db4a0
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 3 deletions.
25 changes: 25 additions & 0 deletions docs/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,31 @@ The library is developed by Wes Holliday (http://wesholliday.net) and Eric Pacui
Related resources
------------------------

If you would like to acknowledge our work in a scientific paper,
please use the following citation:

Wesley H. Holliday and Eric Pacuit (2025). pref_voting: The Preferential Voting Tools package for Python. Journal of Open Source Software, 10(105), 7020. https://doi.org/10.21105/joss.07020

**Bibtex***:

```bibtex
@article{HollidayPacuit2025,
author = {Wesley H. Holliday and Eric Pacuit},
title = {pref_voting: The Preferential Voting Tools package for Python},
journal = {Journal of Open Source Software},
year = {2025},
publisher = {The Open Journal},
volume = {10},
number = {105},
pages = {7020},
doi = {10.21105/joss.07020}
}
```

Related resources
------------------------

- VoteKit (https://votekit.readthedocs.io/) - A Python package developed by the MGGG Redistricting Lab (https://mggg.org/) designed to facilitate the study of different election methods.

- prefsampling (https://comsoc-community.github.io/prefsampling/) - A Python library for sampling from preference profiles with respect to different probability models.
Expand Down
7 changes: 4 additions & 3 deletions pref_voting/utility_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,18 +71,19 @@ def city_block_utility(v_pos: float32[:], c_pos: float32[:]):
return -distance.cityblock(v_pos, c_pos)

@jit(nopython=True, fastmath=True)
def shepsle_utility(v_pos: float32[:], c_pos: float32[:]):
def shepsle_utility(v_pos: float32[:], c_pos: float32[:], kappa: float32 = 1):
"""
The Shepsle utility function from "The Strategy of Ambiguity: Uncertainty and Electoral Competition" by Kenneth A. Shepsle, American Political Science Review, 1972, vol. 66, issue 2, pp. 555-568. For a justification of this utility function, see Appendix B from *Making Multicandidate Elections More Democratic* (https://doi.org/10.1515/9781400859504.114) by S. Merrill III.
Args:
v_pos (numpy array): The position(s) of the voter.
c_pos (numpy array): The position(s) of the candidate.
c_pos (numpy array): The position(s) of the candidate.
kappa (float): A parameter that determines the steepness of the utility function.
Returns:
float: The utility of the candidate to the voter.
"""
d = np.linalg.norm(v_pos - c_pos)
return np.exp(-d**2 / 2)
return np.exp((kappa**2 * -d**2) / 2)


@jit(nopython=True, fastmath=True)
Expand Down

0 comments on commit a7db4a0

Please sign in to comment.