GH-16678 GLM: Control variables - Multinomial, Ordinal#16690
Open
maurever wants to merge 12 commits intorel-3.46.0from
Open
GH-16678 GLM: Control variables - Multinomial, Ordinal#16690maurever wants to merge 12 commits intorel-3.46.0from
maurever wants to merge 12 commits intorel-3.46.0from
Conversation
1 task
Contributor
There was a problem hiding this comment.
Pull request overview
This PR implements support for control variables in GLM for multinomial and ordinal families, extending the existing control variables functionality that was previously only available for other GLM families.
Key changes include:
- Added test coverage for control variables with multinomial and ordinal GLM models in R, Python, and Java
- Implemented
getControlValBetaMultinomial()method to zero out control variable coefficients in multinomial models - Updated scoring logic to properly handle control variables in multinomial/ordinal predictions
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| h2o-r/tests/testdir_algos/glm/runit_GLM_control_variables_ordinal.R | New R test for ordinal GLM with control variables |
| h2o-r/tests/testdir_algos/glm/runit_GLM_control_variables_multinomial.R | New R test for multinomial GLM with control variables |
| h2o-py/tests/testdir_algos/glm/pyunit_glm_control_variables_ordinal.py | New Python test for ordinal GLM with control variables |
| h2o-py/tests/testdir_algos/glm/pyunit_glm_control_variables_multinomial.py | New Python test for multinomial GLM with control variables |
| h2o-algos/src/test/java/hex/glm/GLMControlVariablesTest.java | New Java tests comparing H2O and R implementations for multinomial/ordinal |
| h2o-algos/src/main/java/hex/glm/GLMScore.java | Updated scoring to apply control variable zeroing for multinomial/ordinal models |
| h2o-algos/src/main/java/hex/glm/GLMModel.java | Added getControlValBetaMultinomial() method and updated variable importance calculation |
| h2o-algos/src/main/java/hex/glm/GLM.java | Updated scoring history generation to handle multinomial models with control variables |
| h2o-algos/src/main/java/hex/api/MakeGLMModelHandler.java | Updated unrestricted model creation to handle multinomial/ordinal models |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
h2o-r/tests/testdir_algos/glm/runit_GLM_control_variables_ordinal.R
Outdated
Show resolved
Hide resolved
h2o-r/tests/testdir_algos/glm/runit_GLM_control_variables_multinomial.R
Outdated
Show resolved
Hide resolved
h2o-r/tests/testdir_algos/glm/runit_GLM_control_variables_ordinal.R
Outdated
Show resolved
Hide resolved
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…nal.R Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…inomial.R Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…nal.R Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
tomasfryda
approved these changes
Jan 2, 2026
Contributor
tomasfryda
left a comment
There was a problem hiding this comment.
Looks good to me. Thank you @maurever !
| } | ||
| assert _control_values_idxs_in_adapted_frame != null; | ||
| for (int featureIdx : _control_values_idxs_in_adapted_frame) { | ||
| if (featureIdx < _dinfo._catOffsets.length - 1 && _column_types[featureIdx].equals("Enum")) { |
Contributor
There was a problem hiding this comment.
&& _column_types[featureIdx].equals("Enum")
Is this part really necessary or is it just to be really really sure?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue: #16678