Skip to content

Commit

Permalink
minor revision
Browse files Browse the repository at this point in the history
  • Loading branch information
ggurioli committed Jan 7, 2021
1 parent 147a70a commit 63b431f
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
6 changes: 5 additions & 1 deletion ezyrb/database.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,15 @@ def __getitem__(self, val):
self.scaler_parameters, self.scaler_snapshots)

def __len__(self):
"""
This method returns the number of snapshots
"""
return len(self._snapshots)

def add(self, parameters, snapshots):
"""
TO DOC
Add (by row) new sets of snapshots and paramters to the original
database
"""
if len(parameters) != len(snapshots):
raise RuntimeError('Different number of parameters and snapshots.')
Expand Down
8 changes: 3 additions & 5 deletions ezyrb/pod.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@

"""
Module for Proper Orthogonal Decomposition (POD) via default svd
"""

from reduction import Reduction

import numpy as np

from .reduction import Reduction


class POD(Reduction):
def __init__(self, method='svd', **kwargs):
"""
"""
available_methods = {
'svd': (self._svd, {
'rank': -1
Expand Down
2 changes: 2 additions & 0 deletions ezyrb/reducedordermodel.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ def predict(self, mu):

def test_error(self, test, norm=np.linalg.norm):
"""
Compute the mean norm of the relative error vector of a predicted
test snapshot
"""
predicted_test = self.predict(test.parameters)
return np.mean(norm(predicted_test - test.snapshots, axis=1)/norm(test.snapshots, axis=1))
Expand Down

0 comments on commit 63b431f

Please sign in to comment.