Skip to content

Commit

Permalink
Code formatting with black
Browse files Browse the repository at this point in the history
  • Loading branch information
gtca committed Oct 21, 2024
1 parent 40dcec9 commit 3e7c7e6
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 17 deletions.
4 changes: 2 additions & 2 deletions mofapy2/build_model/build_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ def build_Sigma(self):
warping_open_end=self.smooth_opts["warping_open_end"],
warping_groups=self.smooth_opts["warping_groups"],
opt_freq=self.smooth_opts["opt_freq"],
model_groups=self.smooth_opts["model_groups"] # ,
model_groups=self.smooth_opts["model_groups"], # ,
# use_gpytorch = self.model_opts['use_gpytorch']
)
# Non-warping
Expand All @@ -312,7 +312,7 @@ def build_Sigma(self):
# warping_open_begin = self.smooth_opts['warping_open_begin'],
# warping_open_end = self.smooth_opts['warping_open_end'],
opt_freq=self.smooth_opts["opt_freq"],
model_groups=self.smooth_opts["model_groups"] # ,
model_groups=self.smooth_opts["model_groups"], # ,
# use_gpytorch = self.model_opts['use_gpytorch']
)

Expand Down
4 changes: 1 addition & 3 deletions mofapy2/core/BayesNet.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,9 +234,7 @@ def precompute(self):
if self.options["verbose"]:
print("ELBO before training:")
print(
"".join(
["%s=%.2f " % (k, v) for k, v in elbo.drop("total").items()]
)
"".join(["%s=%.2f " % (k, v) for k, v in elbo.drop("total").items()])
+ "\nTotal: %.2f\n" % elbo["total"]
)
else:
Expand Down
6 changes: 3 additions & 3 deletions mofapy2/core/distributions/beta.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@ def updateExpectations(self):
E = np.divide(a, a + b)
lnE = special.digamma(a) - special.digamma(a + b)
lnEInv = special.digamma(b) - special.digamma(a + b) # expectation of ln(1-X)
lnEInv[
np.isinf(lnEInv)
] = -np.inf # there is a numerical error in lnEInv if E=1
lnEInv[np.isinf(lnEInv)] = (
-np.inf
) # there is a numerical error in lnEInv if E=1
self.expectations = {"E": E, "lnE": lnE, "lnEInv": lnEInv}

def sample(self, n=1):
Expand Down
6 changes: 3 additions & 3 deletions mofapy2/core/nodes/Sigma_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -1075,9 +1075,9 @@ def align_sample_cov_dtw(self, Z):
new_val = tref[ref_idx]
old_val = self.sample_cov[self.warping_groups == g, 0]
new_sample_cov = [new_val[tg == told].item() for told in old_val]
self.sample_cov_transformed[
self.warping_groups == g, 0
] = new_sample_cov
self.sample_cov_transformed[self.warping_groups == g, 0] = (
new_sample_cov
)

# # reorder by covariate value to ensure monotonicity constrains are correctly placed
# idx_ref_order = np.argsort(self.sample_cov[self.warping_groups == self.reference_group,0])
Expand Down
16 changes: 10 additions & 6 deletions mofapy2/run/entry_point.py
Original file line number Diff line number Diff line change
Expand Up @@ -1695,12 +1695,16 @@ def save(
views_names=self.data_opts["views_names"],
groups_names=self.data_opts["groups_names"],
covariates_names=covariates_names,
samples_metadata=self.data_opts["samples_metadata"]
if "samples_metadata" in self.data_opts
else None,
features_metadata=self.data_opts["features_metadata"]
if "features_metadata" in self.data_opts
else None,
samples_metadata=(
self.data_opts["samples_metadata"]
if "samples_metadata" in self.data_opts
else None
),
features_metadata=(
self.data_opts["features_metadata"]
if "features_metadata" in self.data_opts
else None
),
compression_level=9,
)

Expand Down

0 comments on commit 3e7c7e6

Please sign in to comment.