Skip to content

Commit 0fcff38

Browse files
committed
lint.
1 parent cd81097 commit 0fcff38

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

python-package/xgboost/testing/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -447,7 +447,6 @@ def make_position_biased_ltr(
447447
n_samples: int, n_features: int, n_query_groups: int, max_rel: int
448448
) -> ClickFold:
449449
"""Generate position-biased data for testing learning to rank."""
450-
datasets = pytest.importorskip("sklearn.datasets")
451450
ms = pytest.importorskip("sklearn.model_selection")
452451
# from sklearn.model_selection import train_test_split
453452
X, y = datasets.make_classification(n_samples, n_features, n_classes=max_rel)

python-package/xgboost/testing/data.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# pylint: disable=invalid-name
12
"""Utilities for data generation."""
23
import os
34
import zipfile
@@ -349,15 +350,18 @@ def get_mq2008(
349350

350351

351352
class RelDataCV(NamedTuple):
353+
"""Simple data struct for train-test split."""
354+
352355
train: RelData
353356
test: RelData
354357
max_rel: int
355358

356359
def is_binary(self) -> bool:
360+
"""Whether it's binary relevance."""
357361
return self.max_rel == 1
358362

359363

360-
class PBM:
364+
class PBM: # pylint: disable=too-few-public-methods
361365
"""Simulate click data with position bias model. There are other models available in
362366
`ULTRA <https://github.com/ULTR-Community/ULTRA.git>`_ like the cascading model.
363367
@@ -470,7 +474,6 @@ def simulate_one_fold(
470474
"""Simulate clicks for one fold."""
471475
X_fold, y_fold, qid_fold = fold
472476
assert qid_fold.dtype == np.int32
473-
indptr, lengths, values = rlencode(qid_fold)
474477

475478
qids = np.unique(qid_fold)
476479

@@ -554,7 +557,7 @@ def sort_ltr_samples(
554557
qid = qid[sorted_idx]
555558
pos = pos[sorted_idx]
556559

557-
indptr, lengths, values = rlencode(qid)
560+
indptr, _, _ = rlencode(qid)
558561

559562
for i in range(1, indptr.size):
560563
beg = indptr[i - 1]

0 commit comments

Comments
 (0)