[ENH] Add BaseBayesianRegressor class for Bayesian model interface#802
Open
arnavk23 wants to merge 3 commits intosktime:mainfrom
Open
[ENH] Add BaseBayesianRegressor class for Bayesian model interface#802arnavk23 wants to merge 3 commits intosktime:mainfrom
BaseBayesianRegressor class for Bayesian model interface#802arnavk23 wants to merge 3 commits intosktime:mainfrom
Conversation
- Create BaseBayesianRegressor that encapsulates PyMC backend logic - Refactor BayesianLinearRegressor to inherit from BaseBayesianRegressor - Implement standardized MCMC sampling, prediction, and parameter retrieval - Add get_posterior_summary method for posterior analysis - Update dependencies and imports Closes sktime#389
- Add arviz to all_extras in pyproject.toml for Bayesian functionality - Required for BaseBayesianRegressor and Bayesian estimators
BaseBayesianRegressor class for Bayesian model interface
- Remove unused imports from BaseBayesianRegressor - Remove unused training_data variable from BayesianLinearRegressor - Fix code formatting and linting issues
fkiraly
requested changes
Mar 6, 2026
Collaborator
fkiraly
left a comment
There was a problem hiding this comment.
Thanks!
This seems to be primarily MC-based. I think a base Bayesian regressor should be able to accommodate non-MC-paradigms too.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Reference Issues/PRs
Towards #389
What does this implement/fix? Explain your changes.
This PR implements the Bayesian model interface design proposed in issue #389. It introduces a
BaseBayesianRegressorclass that encapsulates PyMC backend logic for MCMC sampling and posterior predictive inference, making it easier to create new Bayesian estimators.The base class handles all PyMC complexity, allowing subclasses to focus only on defining their probabilistic models via the
_build_model()method.Does your contribution introduce a new dependency? If yes, which one?
Yes, adds
arvizas an optional dependency for Bayesian posterior analysis and diagnostics.What should a reviewer concentrate their feedback on?
Did you add any tests for the change?
The existing tests for
BayesianLinearRegressorshould continue to work with the refactored implementation. Additional tests for the base class could be added in a follow-up PR.Any other comments?
This implementation follows the detailed design specification from the issue #389. The base class provides a clean abstraction that will make it easier to implement additional Bayesian estimators in the future.
PR checklist
For all contributions
How to: add yourself to the all-contributors file in the
skproroot directory (not theCONTRIBUTORS.md). Common badges:code- fixing a bug, or adding code logic.doc- writing or improving documentation or docstrings.bug- reporting or diagnosing a bug (get this pluscodeif you also fixed the bug in the PR).maintenance- CI, test framework, release.See here for full badge reference
For new estimators
docs/source/api_reference/taskname.rst, follow the pattern.Examplessection.python_dependenciestag and ensured dependency isolation, see the estimator dependencies guide.