Skip to content

GLM: linear constraints not enforced and NullPointerException when combining beta and linear constraints #16864

Description

@maurever

1. Linear constraints are not enforced

When specifying a linear constraint (e.g. x2 + x3 <= 0), the resulting model coefficients do not satisfy the constraint. The coefficients returned are near-identical to the unconstrained solution, indicating the constraint is silently ignored during optimization.

Example: constraint x2 + x3 <= 0 with unconstrained values x2 ≈ 0.0016, x3 ≈ 0.081 should force both toward zero or negative, but the model returns x2 ≈ 0.0015, x3 ≈ 0.081 — clearly violating the constraint.

2. NullPointerException when combining beta_constraints and linear_constraints

Using both beta_constraints and linear_constraints simultaneously throws an unhandled NullPointerException with no informative error message.

Steps to reproduce:

  • Train a GLM with linear_constraints only (e.g. x2 + x3 <= 0) — observe constraint is not satisfied in output coefficients.
  • Train a GLM with both beta_constraints (e.g. x1 >= 0.03) and linear_constraints (e.g. x2 + x3 <= 0) — observe NPE.

Note: beta_constraints alone works correctly (example with x1 >= 0.03 produces x1 = 0.03 as expected).

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions