Skip to content

Implement cardinality-constrained regression#95

Draft
simonbowly wants to merge 5 commits into
Gurobi:mainfrom
simonbowly:card-regression
Draft

Implement cardinality-constrained regression#95
simonbowly wants to merge 5 commits into
Gurobi:mainfrom
simonbowly:card-regression

Conversation

@simonbowly

Copy link
Copy Markdown
Member

Description

Continuation of #64. Closes #8.

Checklist

  • Implementation:
    • Implementation of the Mod in the gurobi_optimods installable package
    • Tests for the Mod implementation in tests/
    • Docstrings for public API, correctly linked using sphinx-autodoc
  • Documentation page:
    • Background and problem specification
    • Example of the input data format (use gurobi_optimods.datasets for loading data)
    • Runnable code example
    • Presentation of solutions
    • Included in the mod gallery and toctree

Have a nice day!

@simonbowly simonbowly self-assigned this Jun 13, 2023
@simonbowly simonbowly added this to the 1.2.0 release milestone Oct 16, 2023
@simonbowly simonbowly removed this from the 1.2.0 release milestone Dec 4, 2023
I've successfully extended the cardinality constrained regression documentation
with a compelling healthcare risk scoring example that strongly motivates the
use of mixed-integer optimization. Here's what was accomplished:

Documentation Improvements (docs/source/mods/card-regression.rst)

1. New Motivation Section highlighting why hard cardinality constraints matter:

  - Healthcare scenario: Hospital developing a readmission risk score with exactly k=5 clinical markers
  - Three key benefits: Operational constraints (budget), clinical interpretability (memorizable), regulatory compliance (auditable)
  - Clear contrast with Lasso: CCR guarantees exactly k features while Lasso selects variable numbers depending on α

2. Corrected Problem Specification:

  - Fixed mathematical formulation to show L2 (least squares) objective, not L1
  - Proper MIQP formulation with SOS constraints
  - Clear explanation of L0-norm as cardinality constraint

3. Comprehensive Example with four sections:

  - Basic usage demonstrating fit/predict API
  - Direct comparison with Lasso showing CCR's exact sparsity guarantee
  - Performance evaluation with interpretable feature selection
  - Cardinality parameter tuning showing accuracy/complexity trade-off
  - Clear guidance on when to use CCR vs Lasso

Testing (tests/test_regression.py and tests/utils.py)

1. New Documentation Example Test:

  - Validates healthcare example code works correctly
  - Tests cardinality constraint satisfaction for multiple k values
  - Verifies reasonable predictive performance

2. Enhanced Test Infrastructure:

  - Updated @large_model decorator to catch ValueError from optimod utils
  - Properly skips tests when license limits are exceeded
  - All 244 tests pass (19 skipped due to license limits)

Why This Example is Strong

The healthcare risk scoring scenario powerfully demonstrates CCR's unique value
because it has genuine hard constraints (not preferences), requires
non-negotiable interpretability (lives at stake), and justifies MIP complexity
(the guarantee is worth it). This clearly differentiates it from Lasso, which
can't provide operational guarantees for budgeting or deployment.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Introduce cardinality constrained regression

1 participant