Skip to content

Commit

Permalink
4. origin of the refactory after meeting with client
Browse files Browse the repository at this point in the history
  • Loading branch information
qnater committed Oct 4, 2024
1 parent b4b8abe commit eeed95d
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 68 deletions.
90 changes: 25 additions & 65 deletions .idea/workspace.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file modified imputegap/recovery/__pycache__/manager.cpython-312.pyc
Binary file not shown.
8 changes: 6 additions & 2 deletions imputegap/recovery/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,9 +137,13 @@ def normalize(self, normalizer="z_score"):
# Apply min-max normalization
self.data = (self.data - ts_min) / range_ts
else:
mean = np.mean(self.data)
std_dev = np.std(self.data)
mean = np.mean(self.data, axis=0)
std_dev = np.std(self.data, axis=0)

# Avoid division by zero: set std_dev to 1 where it is zero
std_dev[std_dev == 0] = 1

# Apply z-score normalization
self.data = (self.data - mean) / std_dev

def plot(self, raw_matrix, infected_matrix=None, imputed_matrix=None, title="Time Series Data", max_series=None,
Expand Down
Binary file modified tests/__pycache__/test_loading.cpython-312-pytest-8.3.3.pyc
Binary file not shown.
2 changes: 1 addition & 1 deletion tests/test_loading.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def test_loading_normalization_z_score_lib(self):
ts_1.load_timeseries(utils.search_path("chlorine"))
ts_1.normalize()

lib_normalized = zscore(ground_truth.data, axis=None)
lib_normalized = zscore(ground_truth.data, axis=0)

assert np.allclose(ts_1.data, lib_normalized)

0 comments on commit eeed95d

Please sign in to comment.