Skip to content

Commit

Permalink
Fix immutable normalizing
Browse files Browse the repository at this point in the history
  • Loading branch information
arberqoku committed Jun 11, 2024
1 parent 6eb1064 commit 4e517f7
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions muvi/core/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ def _validate_index(self, idx):

def _normalize_observations(self):
logger.info("Normalizing observations.")
for vn, obs in self.observations.items():
for vn in self.observations:
if self.likelihoods[vn] == "bernoulli":
logger.info(
f"Skipping normalization for view `{vn}` with a Bernoulli"
Expand All @@ -268,15 +268,15 @@ def _normalize_observations(self):
continue
if self.nmf[vn]:
logger.info(f"Setting min value of view `{vn}` to 0.")
obs -= np.nanmin(obs, axis=0)
self.observations[vn] -= np.nanmin(self.observations[vn], axis=0)
else:
logger.info(f"Centering features of view `{vn}`.")
obs -= np.nanmean(obs, axis=0)
global_std = np.nanstd(obs)
self.observations[vn] -= np.nanmean(self.observations[vn], axis=0)
global_std = np.nanstd(self.observations[vn])
logger.info(
f"Setting global standard deviation to 1.0 (from {global_std:.3f})."
)
obs /= global_std
self.observations[vn] /= global_std

return self.observations

Expand Down

0 comments on commit 4e517f7

Please sign in to comment.