Improved PB Chance Module
Overview
About a month ago, I pitched an idea in the Livesplit discord (my discord is IDW#1024) of a method to more accurately calculate the chance of PB. This method allows so-called "Skill Curves" to be merged rather than using a binary search to find the percentile that the run must maintain. I've created a Sub-Module in the analysis module called statistical_pb_chance that computes the probability of getting a PB using the method I described. I considered removing the existing pb_chance module, but I thought that might cause chaos.
Benchmarks & Tests
When I initially suggested the idea, there were concerns about the performance. In particular, it was desired that computations take less than a millisecond such that LSO's frame rate would not be affected. To ensure this, I've added two benchmarks in "statistical_pb_chance.rs." For my code and on my computer, both of them are well under a millisecond:
- Calculating the CDF of a probability distribution or "skill curve": ~100 µs
- Merging two probability distributions or "skill curves" through the convolution Theorem: ~20 µs
When rendering a frame, it is only necessary to compute the CDF. The merging of skill curves can be done on a separate thread if necessary, and results are not required until a run is reset.
I've also implemented tests for all my proposed code.
Next Steps
- [ ] Get proposed changes approved
- [ ] Discuss whether the old "pb_chance" module should be entirely removed
- [ ] Discuss whether more abstraction should be added to code to make it easier to use
- [ ] Implement new pb_chance code into LSO web
- [ ] Profit?