Skip to content

Commit

Permalink
Add rank:ndcg and rank:map as valid objectives (#479)
Browse files Browse the repository at this point in the history
As per the XGBoost docs [1] `rank:ndcg` and `rank:map` are valid
objectives, but are currently rejected by the parser.

This commits resolves this by extending the list of objectives which map
to the no-op normalizer, allowing the models to be parsed and used by
the plugin.

[1] https://github.com/dmlc/xgboost/blob/1094d6015df7be6f5829e53a4c257f3481b43ee5/doc/parameter.rst#parameters-for-learning-to-rank-rank-ndcg-rank-map-rank-pairwise
  • Loading branch information
styrmis authored Dec 13, 2023
1 parent 6841c44 commit b03f570
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion docs/training-models.rst
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ Currently supported parameters:

**objective** - Defines the model learning objective as specified in the `XGBoost documentation <https://xgboost.readthedocs.io/en/latest/parameter.html#learning-task-parameters>`_. This parameter can transform the final model prediction. Using logistic objectives applies a sigmoid normalization.

Currently supported values: 'binary:logistic', 'binary:logitraw', 'rank:pairwise', 'reg:linear', 'reg:logistic'
Currently supported values: 'binary:logistic', 'binary:logitraw', 'rank:ndcg', 'rank:map', 'rank:pairwise', 'reg:linear', 'reg:logistic'

===================
Simple linear models
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,8 @@ public static XGBoostDefinition parse(XContentParser parser, FeatureSet set) thr
void setNormalizer(String objectiveName) {
switch (objectiveName) {
case "binary:logitraw":
case "rank:ndcg":
case "rank:map":
case "rank:pairwise":
case "reg:linear":
normalizer = Normalizers.get(Normalizers.NOOP_NORMALIZER_NAME);
Expand Down

0 comments on commit b03f570

Please sign in to comment.