[jvm-packages] Objectives starting with rank: are never classification (#2837)
Training a model with the experimental rank:ndcg objective incorrectly returns a Classification model. Adjust the classification check to not recognize rank:* objectives as classification. While writing tests for isClassificationTask also turned up that obj_type -> regression was incorrectly identified as a classification task so the function was slightly adjusted to pass the new tests.
This commit is contained in:
committed by
Sergei Lebedev
parent
91af8f7106
commit
46f2b820f1
@@ -194,8 +194,8 @@ object XGBoost extends Serializable {
|
||||
val objective = params.getOrElse("objective", params.getOrElse("obj_type", null))
|
||||
objective != null && {
|
||||
val objStr = objective.toString
|
||||
objStr == "classification" || (!objStr.startsWith("reg:") && objStr != "count:poisson" &&
|
||||
objStr != "rank:pairwise")
|
||||
objStr != "regression" && !objStr.startsWith("reg:") && objStr != "count:poisson" &&
|
||||
!objStr.startsWith("rank:")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user