Skip to content

[ENH] Add online regressor support and River adapter - #1068

Open
patelchaitany wants to merge 5 commits into
sktime:mainfrom
patelchaitany:enh/river-online-regressor
Open

[ENH] Add online regressor support and River adapter#1068
patelchaitany wants to merge 5 commits into
sktime:mainfrom
patelchaitany:enh/river-online-regressor

Conversation

@patelchaitany

Copy link
Copy Markdown
Member

Reference Issues/PRs

#1066

What does this implement/fix? Explain your changes.

This PR adds the foundation for online regression in skpro, including a new regressor_online scitype and BaseOnlineRegressor with capability:update and capability:pred_int. It introduces the capability:pred_int tag and gates probabilistic prediction methods on regressors that do not support them. It also adds RiverRegressor as a point-prediction adapter for River models, with deepcopy-based cloning and coerce_to_skpro_regressor() for wrapping raw River estimators.

Does your contribution introduce a new dependency? If yes, which one?

No

What should a reviewer concentrate their feedback on?

Did you add any tests for the change?

Any other comments?

PR checklist

For all contributions
  • I've added myself to the list of contributors with any new badges I've earned :-)
    How to: add yourself to the all-contributors file in the skpro root directory (not the CONTRIBUTORS.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 plus code if you also fixed the bug in the PR).maintenance - CI, test framework, release.
    See here for full badge reference
  • The PR title starts with either [ENH], [MNT], [DOC], or [BUG]. [BUG] - bugfix, [MNT] - CI, test framework, [ENH] - adding or improving code, [DOC] - writing or improving documentation or docstrings.
For new estimators
  • I've added the estimator to the API reference - in docs/source/api_reference/taskname.rst, follow the pattern.
  • I've added one or more illustrative usage examples to the docstring, in a pydocstyle compliant Examples section.
  • If the estimator relies on a soft dependency, I've set the python_dependencies tag and ensured
    dependency isolation, see the estimator dependencies guide.

@patelchaitany
patelchaitany force-pushed the enh/river-online-regressor branch from 88ea31c to 732a597 Compare June 10, 2026 19:31
@patelchaitany
patelchaitany marked this pull request as draft June 10, 2026 19:32
@patelchaitany
patelchaitany force-pushed the enh/river-online-regressor branch 2 times, most recently from 6ca8dfc to 57f3208 Compare June 11, 2026 06:41
@patelchaitany
patelchaitany marked this pull request as ready for review June 11, 2026 09:17
@patelchaitany
patelchaitany force-pushed the enh/river-online-regressor branch 2 times, most recently from ed314f0 to 4424926 Compare June 14, 2026 02:13

@fkiraly fkiraly left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Nice! Though I think there is somet duplication going on.

  • I think the new base class, BaseOnlineRegressor, can be merged into BaseProbaRegressor, there is no substantial added functionality.
  • The new jackknife-plus regressor can be merged into the existing one (the non-MAPIE regressor), simply add the update logic.

Comment thread skpro/regression/enbpi.py Outdated
-------
self : reference to self
"""
errs, bs_vs_ix_new, estimators = self._bootstrap_batch(X, y, self.estimators_)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

As I understand, update is behaving just like a brand new fit on the new batch. Shouldn't _boostrap_batch call _update on the new estimators instead of fit, if the user hass called EnbpiRegressor.update?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I think I made mistake The original EnbpiRegressor dose not update the trained model it only update the residuals

Comment thread skpro/registry/_base_classes.py Outdated
return TestAllRegressors


class regressor_online(_BaseScitypeOfObject):

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Now that there is no BaseOnlineRegressor, we can remove this object type.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Yes we can remove that but for the river using we are using separate tag named regressor_online and in future if create separate test for online_regressor it would be easy to add test, wdyt.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Our API won't be supporting online regression directly, right? Except for update. I believe it would better to follow YAGNI than add this tag at the moment. In addition, this would need to be a separate tag, not a object type value.

Comment thread skpro/registry/_tags.py
}


class capability__pred_int(_BaseTag):

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Could you explain the motivation for this new tag?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Until now all skpro regressors supported probabilistic prediction, so this tag wasn't needed. The River adapter is the first point-prediction-only estimator, so capability:pred_int is needed to distinguish which regressors support predict_interval/predict_proba - matching sktime's convention.

Add River adapter package (utils, clone, RiverRegressor) and a
coerce_to_skpro_regressor helper. Introduce BaseOnlineRegressor and
capability:pred_int tag; update BaseProbaRegressor to check pred_int for
probabilistic methods.
@patelchaitany
patelchaitany force-pushed the enh/river-online-regressor branch from 43fd983 to bde44e9 Compare July 2, 2026 06:21
@patelchaitany
patelchaitany force-pushed the enh/river-online-regressor branch 2 times, most recently from cfe3cfb to 871c953 Compare July 14, 2026 15:57
bool
True if ``obj`` is a River estimator, False otherwise.
"""
if obj is None:

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I think you can preface this with a _check_soft_dependencies call, then you can assume that river is present. That is: if check_soft_dependencies("river"...) is False, return False. Anything that comes after can assume that river is present in the environment.

Why this works: if river is not present, the passed object cannot be a river instance.

@@ -294,6 +298,7 @@ def predict_proba(self, X):
y : skpro BaseDistribution, same length as `X`
labels predicted for `X`
"""

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

are we missing a check_is_fitted here? Unrelated to your PR but it is still missing and shoudl be fixed?

Comment thread pyproject.toml Outdated
"matplotlib>=3.3.2",
"polars<1.43.0",
"pymc; python_version < '3.13'",
"river",

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

we should not add it here - this should be an estimator specific dependency.

@fkiraly fkiraly left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Great, thanks!

Since this would now add "online-only" regressors to the zoo, we also need to check compatibility with:

  • tuners, grid search, etc
  • pipelines
  • further compositions, if any

For instance, there also, the capability:pred_int tag needs to be set consistently with a potential online update regressor.

You could add this in this PR together with tests, or in a PR building on top of this.

Implement online EnbPI: do not refit clones on update; predict with
stored estimators, append new residuals and slide out oldest entries to
maintain a fixed pool size. Refactor _bootstrap_batch to initialize
estimators_ and fix prediction/residual array shapes and indexing.

Signed-off-by: Chaitany Patel <patelchaitany93@gmail.com>
@patelchaitany
patelchaitany force-pushed the enh/river-online-regressor branch from 871c953 to 8c679cd Compare August 10, 2026 13:39
@patelchaitany
patelchaitany requested a review from fkiraly August 10, 2026 13:40
Signed-off-by: Chaitany Patel <patelchaitany93@gmail.com>
…gressor

Signed-off-by: Chaitany Patel <patelchaitany93@gmail.com>

# Conflicts:
#	skpro/regression/online/_dont_refit.py
#	skpro/regression/online/_refit.py
#	skpro/regression/online/_refit_every.py
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.

4 participants