Skip to content

Commit

Permalink
FIX: inputs compatibility issues
Browse files Browse the repository at this point in the history
  • Loading branch information
MarekWadinger committed Feb 26, 2024
1 parent d669ec3 commit 68676b4
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions functions/odmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
TODO:
- [ ] Add base class of river which is base.MiniBatchRegressor
- [ ] Compute amlitudes of the singular values of the input matrix.
- [ ] Align with transposed data in form of (snapshots, features).
References:
[^1]: Zhang, H., Clarence Worth Rowley, Deem, E.A. and Cattafesta, L.N.
Expand Down Expand Up @@ -153,7 +153,8 @@ def __init__(
assert self.w > 0 and self.w <= 1
self.initialize = int(initialize)
self.exponential_weighting = exponential_weighting
np.random.seed(seed)
self.seed = seed
np.random.seed(self.seed)
self.m: int
self.n_seen: int = 0
self.feature_names_in_: list[str]
Expand Down Expand Up @@ -434,10 +435,13 @@ def transform_one(self, x: Union[dict, np.ndarray]) -> np.ndarray:
Returns:
np.ndarray: The transformed input.
"""
if isinstance(x, dict):
x = np.array(list(x.values()))

_, Phi = self.eig
return Phi.T @ x

def transform_many(self, X: Union[dict, np.ndarray]) -> np.ndarray:
def transform_many(self, X: Union[np.ndarray, pd.DataFrame]) -> np.ndarray:
"""
Transforms the given input sequence.
Expand Down

0 comments on commit 68676b4

Please sign in to comment.