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

GH-6605 Fix feature interaction for CV model where tree has depth = 0 #15699

Merged
merged 5 commits into from
Aug 21, 2023

Conversation

maurever
Copy link
Contributor

The first part was fixed here: #15689.

But I found another bug: when the CV model tree has depth 0, it failed. So this PR fixed this bug.

Closes: #6605

@maurever maurever added this to the 3.42.0.3 milestone Aug 16, 2023
@maurever maurever self-assigned this Aug 16, 2023
@maurever maurever changed the title GH-6605 fix feature interaction for trees with depth 0 GH-6605 Fix feature interaction for CV model where tree has depth = 0 Aug 16, 2023
@maurever maurever added the bug label Aug 16, 2023
@@ -43,6 +43,9 @@ public void mergeWith(FeatureInteractions featureInteractions) {
}

public int maxDepth() {
if (this.entrySet().size() == 0){
return 0;
Copy link
Collaborator

Choose a reason for hiding this comment

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

It's weird that actual problem is that FeatureInteractions are empty and all call has no meaning and we handle it in maxDepth funtion. It would be better to check that earlier and raise warning to the user.

Copy link
Collaborator

Choose a reason for hiding this comment

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

It can be simulated this way also:

FeatureInteractions featureInteractions1 = new FeatureInteractions();
System.out.println("featureInteractions1 = " + Arrays.toString(featureInteractions1.getAsTable()));

in FeatureInteractionsTest

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks, @valenad1. Good points! I fixed the case there is no feature interaction for a model.

@maurever maurever requested a review from valenad1 August 17, 2023 09:33
# feature interaction with cv model where tree depth = 0
my_cv_gbm <- h2o.getModel(my_gbm@model$cross_validation_models[[1]]$name)
fi <-h2o.feature_interaction(model = my_cv_gbm)
#print(fi == NaN)
Copy link
Collaborator

Choose a reason for hiding this comment

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

I would turn it to assert

expect_true(is.null(fi))

Copy link
Collaborator

@valenad1 valenad1 left a comment

Choose a reason for hiding this comment

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

LGTM, thank you!

@maurever maurever merged commit edebb37 into rel-3.42.0 Aug 21, 2023
@maurever maurever deleted the maurever_GH-6605_feature_interaction_cv_bug branch August 21, 2023 17:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants