From 4e517f7edc684669dfb538d8d3a599d36b7b460a Mon Sep 17 00:00:00 2001 From: Arber Qoku Date: Tue, 11 Jun 2024 13:11:11 +0200 Subject: [PATCH] Fix immutable normalizing --- muvi/core/models.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/muvi/core/models.py b/muvi/core/models.py index 71a5105..63e58c1 100755 --- a/muvi/core/models.py +++ b/muvi/core/models.py @@ -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" @@ -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