Skip to content

Conversation

@RakshithaKowlikar
Copy link

This PR adds JohnsonQPDRegressor, a wrapper that transforms any sklearn-style quantile regressor into a probabilistic regressor using the Johnson Quantile-Parameterized Distribution (QPD).

Fixes #377

  • Fits three quantile models at (α, 0.5, 1−α)
  • Constructs a QPD_Johnson distribution from predicted quantiles
  • Enforces quantile ordering and minimum spread for stability
  • Optional bounded support via (lower, upper)
  • Compatible with any sklearn regressor that has a quantile parameter

Modified Files

  • skpro/regression/compose/_johnson_quantile.py - New implementation
  • skpro/regression/compose/__init__.py - Added import
  • docs/source/api_reference/regression.rst - Added to API documentation

Copy link
Collaborator

@fkiraly fkiraly left a comment

Choose a reason for hiding this comment

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

Very nice - I've started the tests.

Copy link
Collaborator

@fkiraly fkiraly left a comment

Choose a reason for hiding this comment

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

Nice contribution, but did you run check_estimator (from utils) on the new estimator? That allows you to debug failures quickly.

@fkiraly fkiraly changed the title Add JohnsonQPDRegressor for quantile to probability conversion [ENH] JohnsonQPDRegressor for quantile to probability conversion Nov 26, 2025
@RakshithaKowlikar
Copy link
Author

Thanks for the feedback @fkiraly! I ran the automated tests via pytest which showed them being skipped with NOTSET. I haven't run check_estimator directly yet. Will resolving the failing checks.

@fkiraly
Copy link
Collaborator

fkiraly commented Nov 27, 2025

@RakshithaKowlikar, sounds like something is wrong with your local setup or our test setup with pytest. Could you outline on the dev-chat in the discord how you tried to run the tests and what happened? Might be a bug.

@RakshithaKowlikar
Copy link
Author

@RakshithaKowlikar, sounds like something is wrong with your local setup or our test setup with pytest. Could you outline on the dev-chat in the discord how you tried to run the tests and what happened? Might be a bug.

Yes! The problem was on my end. I have rectified the code and now it doesn't show any fails. Also I think we should add venv to .gitignore
@fkiraly please let me know if further changes are required.

Copy link
Collaborator

@fkiraly fkiraly left a comment

Choose a reason for hiding this comment

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

Quick question: why are you making changes to the qpd distributions? If these need changes, then maybe open a separate PR and explain what you are doing?

@RakshithaKowlikar
Copy link
Author

Changes to qpd.py:

  • sample() method was added to fix TypeError: object of type 'NoneType' has no len(). Because QPD_Johnson was created with scalar parameters (no index/columns specified), self.index was None.
  • theta was clamped to prevent arccosh from receiving invalid inputs when symmetric distribution occurs.
  • wrap in np.errstate to suppress RuntimeWarnings during intermediate calculations because intermediate calculations can produce inf, NaN, or divide-by-zero even though the final result might be valid
  • kappa calculation safety to check for zero before dividing.

Changes in _johnson_quantile.py:

  • changed the spread calculation so that it works across different data scales, works when quantiles are too close together now
  • added _predict_var because when ppf(scalar) is called on a distribution with shape (13, 1), it tries to return shape (13, 13), because ppf is in the base class, shared across all distributions. Fixing it there could break other distributions

@fkiraly should i still open a pr for the changes in qpd.py?

@RakshithaKowlikar
Copy link
Author

Also the errors seem to be linked with GAMRegressor where get_test_params() is returning a single dict

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement module:regression probabilistic regression module

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[ENH] general Johnson QPD regression wrapper to reduce proba to quantile predictions

2 participants