[ENH] add online update to BaggingRegressor#1064
Open
patelchaitany wants to merge 1 commit into
Open
Conversation
fkiraly
requested changes
Jun 6, 2026
Collaborator
There was a problem hiding this comment.
Thanks!
For the algorithm to make sense, in the case where n_samples is an integer, a fraction n_samples / n should be computed in _fit, and applied to the sample in _update.
That is, the row selection probability should remain the same for _fit and _update.
With this insight, it should also be possible to merge the two "resolve size" methods into a single one.
Implement _update so each bagged clone is updated on a row subsample of the incoming batch (same n_samples and bootstrap as fit) with cols_[i] fixed from fit. Set capability:update on the meta-estimator. Partially addresses sktime#1049.
1520b1e to
4e1b46f
Compare
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
Partially addresses #1049.
What does this implement/fix? Explain your changes.
Adds online
updatesupport toBaggingRegressor.On
update, each fitted bagged clone is updated on a row subsample of the incoming batch, using the samen_samplesandbootstrapsettings as infit. Feature subsetscols_[i]fromfitare reused (column sampling is not repeated). Setscapability:update=Trueon the meta-estimator so the publicupdatepath runs; meaningful incremental learning still depends on the inner regressor (batch-only inners effectively no-op). Whenbootstrap=False, subsample size is capped at the update batch size so small batches do not error.Docstring updated to describe
updatebehaviour.Does your contribution introduce a new dependency? If yes, which one?
No.
What should a reviewer concentrate their feedback on?
_updaterow subsampling matchesfitsemantics (includingbootstrap=Falseon small update batches).Did you add any tests for the change?
No dedicated tests added. Covered by existing
test_online_updateintest_all_regressors.pyforBaggingRegressorviaget_test_params().Any other comments?
Follow-up for #1049 may include
EnbpiRegressorand a River wrapper for online inner estimators.PR checklist
For all contributions
For new estimators
docs/source/api_reference/taskname.rst, follow the pattern.Examplessection.python_dependenciestag and ensured dependency isolation, see the estimator dependencies guide.