Make probabilities more intuitive by converting them to odds (i.e. 72.3% becomes "5 in 7")
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
c#
java
javascript
php
python
ruby
website
.gitignore
LICENSE
README.md
TODO.md
testCases.txt

README.md

probabilityToFriendlyString

Make probabilities more intuitive by converting them to odds. (i.e. 72.3% becomes "5 in 7")

Live demo here

Javascript: on npm: probability-to-friendly-string (ES6, tests use node.js)

Python 3: requires Python 3.5 or above

C#: on NuGet: ProbabilityToFriendlyString (.NET Standard 2.0)

Java: built with JDK 8

Ruby: gem probability_to_friendly_string, requires Ruby 2.3.1 or above

PHP: requires PHP 7.0 or above (tests require PHPUnit 6.5)

This project was inspired by FiveThirtyEight's 2018 house forecast, where they use this friendlier way of showing probabilities. I decided to reverse-engineer the algorithm they used and make it easily available to incorporate in other visualizations, etc.