Skip to content

Feat ordinalregression#62

Open
MisterEkole wants to merge 3 commits intoStatMixedML:masterfrom
MisterEkole:feat-ordinalregression
Open

Feat ordinalregression#62
MisterEkole wants to merge 3 commits intoStatMixedML:masterfrom
MisterEkole:feat-ordinalregression

Conversation

@MisterEkole
Copy link
Copy Markdown

Summary

Implements the OrderedLogistic distribution for ordinal regression (closes #54).

Uses the cumulative link (proportional odds) model via Pyro's
OrderedLogisticdistribution. Cutpoint monotonicity is enforced through a cumulative
softplus reparameterisation, keeping all K tree outputs unconstrained while guaranteeing strict ordering at all times.

Changes

  • lightgbmlss/distributions/OrderedLogistic.py — new distribution class
  • lightgbmlss/distributions/__init__.py — register distribution
  • tests/test_distributions/test_ordinal.py — 17 unit tests
  • tests/utils.py — exclude from generic fixtures
  • docs/examples/OrderedLogistic_Regression.ipynb — end-to-end example
    notebook

Test plan

  • All 17 ordinal-specific tests pass (pytest tests/test_distributions/test_ordinal.py)
  • Existing test suite unaffected (pytest tests/test_distributions/)
  • Notebook runs end-to-end on simulated K=4 ordinal data

…ixedML#54)

  Implements the cumulative link (proportional odds) model as a new
  distribution class. Uses a cumulative softplus reparameterisation to
  enforce strict cutpoint ordering without constrained optimisation.

  - lightgbmlss/distributions/OrderedLogistic.py: new distribution with
    overrides for get_params_loss, calculate_start_values, draw_samples,
    and predict_dist; supports pred_type="class_probs" in addition to
    the standard parameters/samples/quantiles
  - lightgbmlss/distributions/__init__.py: register OrderedLogistic
  - tests/test_distributions/test_ordinal.py: 17 unit tests covering
    init validation, cutpoint monotonicity, forward pass, autograd,
    sampling, and LightGBM integration
  - tests/utils.py: exclude OrderedLogistic from generic fixtures
  - docs/examples/OrderedLogistic_Regression.ipynb: end-to-end example
    with simulated ordinal data, hyper_opt, evaluation (accuracy, MAE,
    Kendall tau, QWK), SHAP interpretability, and class probability plots
@StatMixedML StatMixedML self-requested a review March 17, 2026 07:48
Repository owner deleted a comment from claude Bot Mar 18, 2026
Repository owner deleted a comment from claude Bot Mar 18, 2026
@StatMixedML
Copy link
Copy Markdown
Owner

@copilot

@StatMixedML StatMixedML removed their assignment Mar 18, 2026
@StatMixedML StatMixedML requested review from Copilot and removed request for StatMixedML March 18, 2026 07:37
Copy link
Copy Markdown

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

Adds ordinal regression support to lightgbmlss by introducing a new OrderedLogistic distribution built on Pyro’s cumulative-link (ordered logistic) likelihood, plus targeted unit tests and small test harness adjustments.

Changes:

  • Introduces lightgbmlss.distributions.OrderedLogistic with cutpoint ordering enforced via cumulative softplus.
  • Registers the new distribution in lightgbmlss/distributions/__init__.py.
  • Adds a dedicated ordinal test module and excludes OrderedLogistic from generic distribution fixtures.

Reviewed changes

Copilot reviewed 4 out of 6 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
lightgbmlss/distributions/OrderedLogistic.py New ordinal distribution implementation (loss, start values, sampling, prediction).
lightgbmlss/distributions/__init__.py Imports/exports OrderedLogistic for package registration.
tests/test_distributions/test_ordinal.py Adds ordinal-specific tests for initialization, cutpoints, gradients, and objective integration.
tests/utils.py Excludes OrderedLogistic from generic fixtures due to custom parameter structure.
.gitignore Ignores VS Code and pytest cache artifacts.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread lightgbmlss/distributions/OrderedLogistic.py Outdated
Comment thread lightgbmlss/distributions/OrderedLogistic.py
Comment thread lightgbmlss/distributions/OrderedLogistic.py
Comment thread lightgbmlss/distributions/OrderedLogistic.py Outdated
Comment thread tests/test_distributions/test_ordinal.py
@StatMixedML
Copy link
Copy Markdown
Owner

@MisterEkole Thanks for raising the PR! Really appreciate your contribution.

May I ask you to look into the comments above?

Repository owner deleted a comment from claude Bot Mar 18, 2026
Repository owner deleted a comment from claude Bot Mar 18, 2026
@MisterEkole
Copy link
Copy Markdown
Author

@StatMixedML I pushed fixes for the review comments — added label validation (non-integer/out-of-range targets now raise a clear error instead of silently truncating), fixed the column naming mismatch in predict_dist, cleaned up docstrings, and added tests for all predict_dist branches. Ready for another look!

@StatMixedML
Copy link
Copy Markdown
Owner

@copilot Review the changes by @MisterEkole

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.

Ordinal regression support

4 participants