Rework MAP and Pairwise for LTR. (#9075)
This commit is contained in:
@@ -431,8 +431,11 @@ def make_ltr(
|
||||
"""Make a dataset for testing LTR."""
|
||||
rng = np.random.default_rng(1994)
|
||||
X = rng.normal(0, 1.0, size=n_samples * n_features).reshape(n_samples, n_features)
|
||||
y = rng.integers(0, max_rel, size=n_samples)
|
||||
qid = rng.integers(0, n_query_groups, size=n_samples)
|
||||
y = np.sum(X, axis=1)
|
||||
y -= y.min()
|
||||
y = np.round(y / y.max() * max_rel).astype(np.int32)
|
||||
|
||||
qid = rng.integers(0, n_query_groups, size=n_samples, dtype=np.int32)
|
||||
w = rng.normal(0, 1.0, size=n_query_groups)
|
||||
w -= np.min(w)
|
||||
w /= np.max(w)
|
||||
|
||||
Reference in New Issue
Block a user