Skip to content

GH-16678 GLM: Control variables - Multinomial, Ordinal#16690

Open
maurever wants to merge 12 commits intorel-3.46.0from
maurever_GH-16524_glm_control_variables_multinomial
Open

GH-16678 GLM: Control variables - Multinomial, Ordinal#16690
maurever wants to merge 12 commits intorel-3.46.0from
maurever_GH-16524_glm_control_variables_multinomial

Conversation

@maurever
Copy link
Contributor

Issue: #16678

@maurever maurever added this to the 3.46.0.10 milestone Nov 13, 2025
@maurever maurever self-assigned this Nov 13, 2025
@maurever maurever changed the title GLM: Control variables - Multinomial GH-16678 GLM: Control variables - Multinomial Nov 13, 2025
@maurever maurever marked this pull request as draft November 13, 2025 14:29
@maurever maurever requested a review from Copilot December 8, 2025 11:02
@maurever maurever marked this pull request as ready for review December 8, 2025 11:04
@maurever maurever changed the title GH-16678 GLM: Control variables - Multinomial GH-16678 GLM: Control variables - Multinomial, Ordinal Dec 8, 2025
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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.

maurever and others added 8 commits December 8, 2025 20:28
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>
Copy link
Contributor

@tomasfryda tomasfryda left a comment

Choose a reason for hiding this comment

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

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")) {
Copy link
Contributor

Choose a reason for hiding this comment

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

&& _column_types[featureIdx].equals("Enum")

Is this part really necessary or is it just to be really really sure?

@valenad1 valenad1 modified the milestones: 3.46.0.10, 3.46.0.11 Mar 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants