Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[jvm-packages] Automatically set maximize_evaluation_metrics if not explicitly given in XGBoost4J-Spark #4446

Merged
merged 4 commits into from
May 9, 2019
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ object XGBoost extends Serializable {
.map(_.toString.toInt).getOrElse(0)
val overridedParams = if (numEarlyStoppingRounds > 0 &&
!params.contains("maximize_evaluation_metrics")) {
if params.contains("custom_eval") {
if (params.contains("custom_eval")) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

when num_early_stopping_rounds is non-zero, eval_metric is a built-in metric, the custom_eval is still in params, just the value is null, so it will still throw an exception.
So the if condition should be if (params.contains("custom_eval") && params("custom_eval") != null) or remove custom_eval from params.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmmm....I think I missed some part of this PR

The reality is early stopping doesn’t work with custom metrics

throw new IllegalArgumentException("maximize_evaluation_metrics has to be "
+ "specified when custom_eval is set")
}
Expand Down