Show Ties Honestly in a CaptchaTheCat Scorecard
If I use a public CaptchaTheCat comparison as a starting point for a scorecard, I want to know what it means when two rows show the same number. Two estimates may be exactly equal under the metric. They may differ only beyond the printed precision. One may even be missing while a spreadsheet has turned that absence into zero. A useful scorecard distinguishes these cases and tells the reader how…
When comparing two rows in the CaptchaTheCat scorecard that display the same figure, it's essential to understand the underlying values and the reasons behind the display order. The metric population and date range should be displayed alongside the score. A valid proportion over one eligible category may not be comparable with a valid proportion over all categories, which can create a false sense of competition when sorted together.
In a multi-section table, it's crucial to validate that each group has a shared scope before applying the ranking policy. If the scope is unknown, it's best to show the evidence gap. To illustrate, let's consider the example provided:
Alpha received 18 out of 20, Beta received 9 out of 10, and Gamma received 8 out of 10. However, Delta has an empty observation window.
The code handles different scenarios, such as an empty observation window, a zero positive observation as a real measured zero when the denominator is positive, and a zero denominator as unavailable. It also checks that the passed count is sensible for each row.
The function rank_rows takes a list of rows, represented as tuples containing the label, positive observations, and total observations. The function performs several checks to ensure the input data is valid. If the total observations are not zero, the row is considered available and sorted based on the rate (positive observations divided by total observations) in descending order. If the total observations are zero, the row is considered missing.
After sorting the available rows, the function assigns ranks to each row. If the rate (positive observations divided by total observations) is different from the previous row, the rank is incremented by one. If dense mode is enabled, the rank is set to the index of the row (starting from 1). The function returns a tuple containing the sorted available rows and a sorted list of missing rows.
In the example provided, Alpha and Beta have the same rate (9/10), so they share the same rank (1). Gamma has a different rate (8/10), so it receives the next rank (3). Delta has an empty observation window, so it is considered missing.
The code also checks that the ranks and rates are calculated correctly for both regular and dense modes. It asserts that the ranks are as expected and the rates match the calculated values.
Rewritten by urgent.news; may contain errors — check the original.
Source: dev.to