Skip to content

Reset ensemble coefficients before each fit - #696

Open
Afloat16 wants to merge 1 commit into
dynamicslab:mainfrom
Afloat16:fix/ensemble-refit-members-20261010
Open

Afloat16 wants to merge 1 commit into
dynamicslab:mainfrom
Afloat16:fix/ensemble-refit-members-20261010

Conversation

@Afloat16

@Afloat16 Afloat16 commented Oct 9, 2026

Copy link
Copy Markdown

Repeated fit calls append new members to EnsembleOptimizer.coef_list from previous fits, so aggregation mixes the previous and current training data. For example, fitting three members with coefficient 1 and then three with coefficient 3 produces a median of 2 instead of 3. Changing the number of features or targets can also fail while aggregating incompatible old and new coefficient shapes.

Reset the member list at the start of each ensemble reduction. The existing bagging, library selection, aggregation and random-state behavior within the current fit are preserved.

The regressions cover median and custom mean aggregation, changed coefficient shapes, changed member counts with bagging/library/combined ensembles, retained previous member snapshots, and repeated public SINDy.fit calls. Full-rank linear systems and zero responses provide independent coefficient references.

Local validation on Windows with Python 3.12.13, NumPy 2.2.6, SciPy 1.15.3 and scikit-learn 1.6.1:

  • The complete original ensemble and invalid-parameter functions pass before and after: 7 cases each. All 7 new cases fail before the fix; all 14 affected cases pass afterwards, with the same 5 existing warnings in each phase.
  • The default isolated wheel and source-distribution build succeeds. Installing the produced wheel into a separate target and importing the public API with isolated Python succeeds without checkout fallback.
  • The pinned pre-commit run --all-files reports 11 hooks passed. Flake8 7.3.0 fails locally with MemoryError in its automatic multiprocessing workers. Supplemental checks use the same installed Flake8, original configuration and complete standard hook file selection, adding --jobs=1; both the before and after checks pass without diagnostics. The original hook failure is retained.

The full upstream test matrix, documentation build and ASV benchmarks have not been run locally.

Keep coefficient members local to the current ensemble fit. Verify unique linear solutions, shape changes, retained snapshots and repeated public SINDy fits.

This branch has not been deployed

No deployments
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.

1 participant