Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add decomposition methods OnlineSVD, OnlinePCA, OnlineDMD/wC + Hankelizer #1509

Open
wants to merge 89 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
89 commits
Select commit Hold shift + click to select a range
42e77e0
Initial commit
MarekWadinger Feb 13, 2024
ec86781
ADD: Class DMM, OnlineDMD, with Control, Weighting and Windowing
MarekWadinger Feb 13, 2024
c922746
UPDATE: make r optional + REFACTOR: DMDC -> DMDwC
MarekWadinger Feb 15, 2024
ddac257
UPDATE: align inputs with river.MiniBatchRegressor
MarekWadinger Feb 15, 2024
37fa925
UPDATE: align notation of DMDMD and ODMD
MarekWadinger Feb 15, 2024
c73362f
FIX: missing _Y buffer for xi comp + REMOVE: cvxpy dependency of xi comp
MarekWadinger Feb 20, 2024
68d1e44
ADD: initial implementation of SubIDDriftDetector
MarekWadinger Feb 20, 2024
95d87bf
UPDATE: remove cvxpy dep of DMD
MarekWadinger Feb 21, 2024
a522752
ADD: input Y for compatibility + FIX: known B handling
MarekWadinger Feb 22, 2024
4d25fe4
ADD: r to control truncation of eig + REFACTOR: rename eigs_modes -> …
MarekWadinger Feb 22, 2024
057e006
REFACTOR: train_size -> ref_size; _drift_detected -> drift_detected +…
MarekWadinger Feb 22, 2024
17219d6
ADD: hankel function
MarekWadinger Feb 22, 2024
ccfd725
FORMAT: ruff
MarekWadinger Feb 22, 2024
ae2f0b6
ADD: automations and dev tools
MarekWadinger Feb 22, 2024
9d7d460
FIX: Py3.9 compatibility
MarekWadinger Feb 22, 2024
ad931c2
UPDATE: actions versions
MarekWadinger Feb 22, 2024
bd1f372
UPDATE: actions versions
MarekWadinger Feb 22, 2024
2ab0d72
ADD: OnlineDMD tests
MarekWadinger Feb 22, 2024
4fcaaff
UPDATE: badge handling
MarekWadinger Feb 22, 2024
db21046
REMOVE: redundant arguments in action
MarekWadinger Feb 23, 2024
5a2ca4f
ADD: tests + FIX: _update_many; _init_update
MarekWadinger Feb 23, 2024
86f4ad4
FORMAT: ruff
MarekWadinger Feb 23, 2024
1f15527
FIX: numerical precison issue in tesst
MarekWadinger Feb 23, 2024
d669ec3
ADD: tranform_one and transform_many options
MarekWadinger Feb 26, 2024
68676b4
FIX: inputs compatibility issues
MarekWadinger Feb 26, 2024
428a337
UPDATE: standardize inputs shape (m, n) -> (n, m)
MarekWadinger Feb 27, 2024
b7ed6e3
UPDATE: try to speed up eig computation
MarekWadinger Feb 29, 2024
54e6833
UPDATE: standardize inputs shape (m, n) -> (n, m) + speed up
MarekWadinger Feb 29, 2024
4784d80
ADD: TODO item
MarekWadinger Feb 29, 2024
02f28bd
Merge pull request #1 from MarekWadinger/dev
MarekWadinger Feb 29, 2024
fde991c
ADD: OnlineSVD implementation
MarekWadinger Feb 29, 2024
0afb16e
FIX: update + revert implementation discrepancy
MarekWadinger Mar 1, 2024
a30cae2
ADD: Online PCA based on Eftekhari, et al. 2019
MarekWadinger Mar 5, 2024
485282e
ADD: Hankelizer as river.Transformer
MarekWadinger Mar 6, 2024
942b654
FIX: feature_names_in_: set -> list
MarekWadinger Mar 6, 2024
2f9b869
FIX: stateful -> stateless transform_one
MarekWadinger Mar 6, 2024
249e740
FIX: b > n_components case + ADD: doctest
MarekWadinger Mar 6, 2024
7a454e1
UPDATE: enable unsupervised transformation with OnlineDMD
MarekWadinger Mar 6, 2024
510b6be
ADD: tests + FIX: minor shape errors here and there
MarekWadinger Mar 6, 2024
bb7137f
FORMAT: align with river
MarekWadinger Mar 6, 2024
d876fa1
Merge pull request #2 from MarekWadinger/dev
MarekWadinger Mar 6, 2024
dff2a94
REMOVE: unvanted files in merged
MarekWadinger Mar 6, 2024
671a7a1
REMFACTOR: align structure
MarekWadinger Mar 6, 2024
56379d1
Merge remote-tracking branch 'source/river-merge'
MarekWadinger Mar 6, 2024
a1f4f1f
REFACTOR: first part of mypy and ruff refactoring
MarekWadinger Mar 6, 2024
feb5d5e
Merge branch 'online-ml:main' into main
MarekWadinger Mar 6, 2024
12ff844
PATCH: type override OnlineDMDwC -> OnlineDMD
MarekWadinger Mar 6, 2024
742799e
UPDATE: release notes on decomposition and preprocessing
MarekWadinger Mar 6, 2024
19456d3
UPDATE: DMD truncation + ADD: module's init; SVD sorting
MarekWadinger Mar 10, 2024
c5b97f3
FIX: truncated DMD; dimensions in DMDwC + ADD: reconstruct full A and B
MarekWadinger Mar 13, 2024
173d8d5
UPDATE: align logic of Hankel with Unsupervised transformer -> 1. lea…
MarekWadinger Mar 13, 2024
ab05cf3
UPDATE: preprocessign init + ADD: TODOs + ADD: test_one_svd_is_enough
MarekWadinger Mar 13, 2024
f7dce6c
UPDATE: preprocessign init + ADD: TODOs + ADD: test_one_svd_is_enough
MarekWadinger Mar 13, 2024
8cbe95f
UPDATE: initialization logic in oSVD and oPCA; exact SVD computation
MarekWadinger Mar 14, 2024
113253d
FIX: exact SVD case + column updates in V
MarekWadinger Mar 14, 2024
8ae4c6c
UPDATE: default val in Hankel to pass test
MarekWadinger Mar 14, 2024
64272e8
UPDATE: ellipsis in osvd test for changing sign
MarekWadinger Mar 14, 2024
972abea
FIX: n_seen discrepancy; revert + UPDATE: more ellipsis
MarekWadinger Mar 14, 2024
f3858ea
MINOR: remove non-necessary transformation
MarekWadinger Mar 21, 2024
2f117dd
UPDATE: optimize speed of DMD by storing solutions
MarekWadinger Mar 21, 2024
e174afb
FIX: eig_rtol usage
MarekWadinger Mar 21, 2024
e2dde3c
REFACTOR: align function sorting
MarekWadinger Mar 21, 2024
193488d
FIX: dims in OnlineDMD/wC + FIX
MarekWadinger Mar 21, 2024
6e5dd3b
FIX: minor issues with different attr. combinations + UPDATE: modes o…
MarekWadinger Mar 22, 2024
8e2985f
ADD: OnlineSVD Zhang implementation for efficient reorthogonalization
MarekWadinger Mar 24, 2024
f84ed46
FIX: eigvals sorting
MarekWadinger Mar 24, 2024
d67ffbd
UPDATE: use **params for learning in pipeline
MarekWadinger Mar 24, 2024
18d76c2
ADD: OnlineSVD revert using Zhang
MarekWadinger Apr 5, 2024
fa1ebcc
FIX: mainly mypy alignment
MarekWadinger Apr 5, 2024
a8c9796
FIX: notation; REFACTOR: extract funs + hierarchy; DOCUMENTATION
MarekWadinger Apr 10, 2024
7b79eb1
REFACTOR: _init_first_pass to reduce redundancy + minor comments impr…
MarekWadinger Apr 11, 2024
af3aea5
ADD: revert multisample support; FIX: svd._V -> svd._Vt
MarekWadinger Apr 11, 2024
06c1932
FIX: typo in U update
MarekWadinger Apr 11, 2024
54bb2ab
FIX: osvd learn_many and doctests
MarekWadinger Apr 11, 2024
1d68d28
FIX: minor issues for specific scenarios
MarekWadinger Apr 22, 2024
08472bb
UPDATE: more control by user + FIX: minor issues
MarekWadinger Apr 29, 2024
cbac2c5
FIX: hiden problem with revert method
MarekWadinger Apr 29, 2024
6a9204d
FIX: problems occuring on rare occasions
MarekWadinger May 2, 2024
1e7f804
UPDATE: major changes in revert and new nomenclature in OnlineSVDZhang
MarekWadinger May 9, 2024
b8a2fa2
DATE: major changes in revert and new nomenclature in OnlineSVDZhang
MarekWadinger May 9, 2024
81cc850
Merge branch 'main' of github.com:MarekWadinger/river
MarekWadinger May 10, 2024
e7870bf
MINOR: changes hard to categorize
MarekWadinger May 10, 2024
4dfd138
MINOR: fixtures and refactoring
MarekWadinger May 15, 2024
f88ba4c
FIX: revert logic when y=None
MarekWadinger May 29, 2024
caaa432
UPDATE: enable np.array for benchmarking
MarekWadinger May 29, 2024
9674783
UPDATE: drop warnings in initialization
MarekWadinger Jun 4, 2024
f5352c6
ADD: benchmark decomposition methods np vs pd inputs
MarekWadinger Jun 4, 2024
018a614
Merge branch 'main' of github.com:online-ml/river into online-ml-main
MarekWadinger Aug 9, 2024
52e6ad4
Merge branch 'online-ml-main'
MarekWadinger Aug 9, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
236 changes: 236 additions & 0 deletions benchmarks/decomposition_methods.ipynb

Large diffs are not rendered by default.

21 changes: 21 additions & 0 deletions docs/unreleased.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Unreleased

## drift

- Added `FHDDM` drift detector.
- Added a `iter_polars` function to iterate over the rows of a polars DataFrame.

## neighbors

- Simplified `neighbors.SWINN` to avoid recursion limit and pickling issues.

## decomposition

- Added `decomposition.OnlineSVD` class to perform Singular Value Decomposition.
- Added `decomposition.OnlinePCA` class to perform Principal Component Analysis.
- Added `decomposition.OnlineDMD` class to perform Dynamic Mode Decomposition.
- Added `decomposition.OnlineDMDwC` class to perform Dynamic Mode Decomposition with Control.

## preprocessing

- Added `preprocessing.Hankelizer` class to perform Hankelization of data stream.
4 changes: 2 additions & 2 deletions river/compose/pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -471,11 +471,11 @@ def learn_one(self, x: dict, y=None, **params):
# Here the step is not a transformer, and it's supervised, such as a LinearRegression.
# This is usually the last step of the pipeline.
elif step._supervised:
step.learn_one(x=x, y=y)
step.learn_one(x=x, y=y, **params)
# Here the step is not a transformer, and it's unsupervised, such as a KMeans. This
# is also usually the last step of the pipeline.
else:
step.learn_one(x=x)
step.learn_one(x=x, **params)

def _transform_one(self, x: dict):
"""This methods takes care of applying the first n - 1 steps of the pipeline, which are
Expand Down
16 changes: 16 additions & 0 deletions river/decomposition/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
"""Decomposition.

"""
from __future__ import annotations

from .odmd import OnlineDMD, OnlineDMDwC
from .opca import OnlinePCA
from .osvd import OnlineSVD, OnlineSVDZhang

__all__ = [
"OnlineSVD",
"OnlineSVDZhang",
"OnlineDMD",
"OnlineDMDwC",
"OnlinePCA",
]
Loading
Loading