Skip to content

Commit 06f264b

Browse files
authored
Add Large Dataset to Benchmarks (#106)
* Fixes philihp/openskill.js#453 and adds a better benchmark for ranks. Signed-off-by: Vivek Joshy <8206808+vivekjoshy@users.noreply.github.com> * Fix processor not found error Signed-off-by: Vivek Joshy <8206808+vivekjoshy@users.noreply.github.com> * Add changelog Signed-off-by: Vivek Joshy <8206808+vivekjoshy@users.noreply.github.com> --------- Signed-off-by: Vivek Joshy <8206808+vivekjoshy@users.noreply.github.com>
1 parent 7e2f977 commit 06f264b

20 files changed

+664
-261
lines changed

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
*.csv filter=lfs diff=lfs merge=lfs -text
22
*.jsonl filter=lfs diff=lfs merge=lfs -text
3+
*.7z filter=lfs diff=lfs merge=lfs -text

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,3 +133,6 @@ dmypy.json
133133

134134
# PDM
135135
/.pdm-build/
136+
137+
# Data Files
138+
/benchmark/data/pubg.csv

benchmark/README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Benchmark Instructions
2+
3+
Simply run ``benchmark.py`` with a compatible Python version and choose the options.
4+
5+
## Available Benchmarks
6+
7+
- ``Win``: Compares win performance against TrueSkill.
8+
- ``Draw``: Predicts draws on standard chess matches.
9+
- ``Rank``: Predicts the rank of players.
10+
- ``Large``: Uses rank prediction on a large multi-faction dataset.
11+
12+
The ``Large`` benchmark requires the ``pubg.csv`` file (around 1 GB) be extracted from ``pubg.7z`` and place in the ``data`` folder.

benchmark/benchmark.py

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
from processors import Draw, Large, Rank, Win
12
from prompt_toolkit import HTML
23
from prompt_toolkit import print_formatted_text as print
34
from prompt_toolkit import prompt
@@ -11,7 +12,6 @@
1112
ThurstoneMostellerFull,
1213
ThurstoneMostellerPart,
1314
)
14-
from processors import Draw, Rank, Win
1515

1616

1717
class NumberValidator(Validator):
@@ -39,7 +39,7 @@ def validate(self, document):
3939
model_names = {m.__name__: m for m in models}
4040
model_completer = WordCompleter(list(model_names.keys()))
4141

42-
benchmark_types = [Win, Draw, Rank]
42+
benchmark_types = [Win, Draw, Rank, Large]
4343
benchmark_type_names = {_.__name__: _ for _ in benchmark_types}
4444
benchmark_types_completer = WordCompleter(list(benchmark_type_names.keys()))
4545

@@ -92,6 +92,15 @@ def validate(self, document):
9292
)
9393
rank_processor.process()
9494
rank_processor.print_result()
95-
else:
96-
print(HTML("<style fg='Red'>Processor Not Found</style>"))
97-
quit()
95+
elif input_benchmark_type == "Large":
96+
large_processor = Large(
97+
path="data/pubg.csv",
98+
seed=input_seed,
99+
minimum_matches=minimum_matches,
100+
model=model,
101+
)
102+
large_processor.process()
103+
large_processor.print_result()
104+
else:
105+
print(HTML("<style fg='Red'>Processor Not Found</style>"))
106+
quit()

benchmark/data/pubg.7z

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
version https://git-lfs.github.com/spec/v1
2+
oid sha256:3e24c9fdee00f5ca20a9da3ec05feff2e0305be6d3832eeecac995c3504f4e48
3+
size 131884839

benchmark/processors/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
from .draw import Draw
2+
from .large import Large
23
from .rank import Rank
34
from .win import Win

0 commit comments

Comments
 (0)