-
-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Faster runtime of predict_win and predict_draw #48
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please format the code with black .
so that the checks can pass. Can you also add two spaces between the test functions for predicting wins as per PEP 8 E302.
Sure thing! (sorry Python is a new language to me, I'll see what I can do) |
* main: Bump furo from 2022.2.23 to 2022.3.4 Fix wrong variable in benchmarks
Codecov Report
@@ Coverage Diff @@
## main #48 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 11 11
Lines 503 488 -15
Branches 110 106 -4
=========================================
- Hits 503 488 -15
Continue to review full report at Codecov.
|
Description of Changes
itertools.permutations
to give permutation pairs, rather than all full permutationsI noticed that for teams of ABCD, your code as written was finding all permutations (ABCD, ABDC, ACBD, ACDB, ...) and then only using the first two from the permutation, which for n>=4 teams, this causes the same pairings to be calculated multiple times.
This should reduce runtime from O(n^n) to O(n^2).
Affirmation
By submitting this Pull Request or typing my (user)name below,
I affirm the Developer Certificate of Origin
with respect to all commits and content included in this PR,
and understand I am releasing the same under openskill.py's MIT license.
I certify the above statement is true and correct:
Philihp Busby