MCPcopy Create free account
hub / github.com/dmlc/xgboost / fit

Function fit

tests/python/test_ranking.py:75–84  ·  view source on GitHub ↗
(ltr: xgboost.XGBRanker)

Source from the content-addressed store, hash-verified

73 X, y, q, w = tm.make_ltr(n_samples=1024, n_features=4, n_query_groups=3, max_rel=44)
74
75 def fit(ltr: xgboost.XGBRanker):
76 ltr.fit(
77 X,
78 y,
79 qid=q,
80 sample_weight=w,
81 eval_set=[(X, y)],
82 eval_qid=(q,),
83 sample_weight_eval_set=(w,),
84 )
85
86 ltr = xgboost.XGBRanker(tree_method="hist", ndcg_exp_gain=True, n_estimators=2)
87 with pytest.raises(ValueError, match="Set `ndcg_exp_gain`"):

Callers 1

test_ndcg_non_expFunction · 0.85

Calls 1

fitMethod · 0.45

Tested by

no test coverage detected