|
| 1 | +# pylint: disable=invalid-name |
1 | 2 | """Utilities for data generation."""
|
2 | 3 | import os
|
3 | 4 | import zipfile
|
@@ -349,15 +350,18 @@ def get_mq2008(
|
349 | 350 |
|
350 | 351 |
|
351 | 352 | class RelDataCV(NamedTuple):
|
| 353 | + """Simple data struct for train-test split.""" |
| 354 | + |
352 | 355 | train: RelData
|
353 | 356 | test: RelData
|
354 | 357 | max_rel: int
|
355 | 358 |
|
356 | 359 | def is_binary(self) -> bool:
|
| 360 | + """Whether it's binary relevance.""" |
357 | 361 | return self.max_rel == 1
|
358 | 362 |
|
359 | 363 |
|
360 |
| -class PBM: |
| 364 | +class PBM: # pylint: disable=too-few-public-methods |
361 | 365 | """Simulate click data with position bias model. There are other models available in
|
362 | 366 | `ULTRA <https://github.com/ULTR-Community/ULTRA.git>`_ like the cascading model.
|
363 | 367 |
|
@@ -470,7 +474,6 @@ def simulate_one_fold(
|
470 | 474 | """Simulate clicks for one fold."""
|
471 | 475 | X_fold, y_fold, qid_fold = fold
|
472 | 476 | assert qid_fold.dtype == np.int32
|
473 |
| - indptr, lengths, values = rlencode(qid_fold) |
474 | 477 |
|
475 | 478 | qids = np.unique(qid_fold)
|
476 | 479 |
|
@@ -554,7 +557,7 @@ def sort_ltr_samples(
|
554 | 557 | qid = qid[sorted_idx]
|
555 | 558 | pos = pos[sorted_idx]
|
556 | 559 |
|
557 |
| - indptr, lengths, values = rlencode(qid) |
| 560 | + indptr, _, _ = rlencode(qid) |
558 | 561 |
|
559 | 562 | for i in range(1, indptr.size):
|
560 | 563 | beg = indptr[i - 1]
|
|
0 commit comments