fmt: formatting

This commit is contained in:
2023-07-26 20:21:53 -05:00
parent 598dad1e6d
commit 4726ccfb8c
2 changed files with 13 additions and 5 deletions

View File

@@ -200,7 +200,9 @@ class BayesRunWithSubspaceSimulation:
for (name, result) in zip(self.model_names, results): for (name, result) in zip(self.model_names, results):
if result.over_target_likelihood is None: if result.over_target_likelihood is None:
clamped_likelihood = result.probs_list[-1][0] / CLAMPING_FACTOR clamped_likelihood = result.probs_list[-1][0] / CLAMPING_FACTOR
_logger.warning(f"got a none result, clamping to {clamped_likelihood}") _logger.warning(
f"got a none result, clamping to {clamped_likelihood}"
)
else: else:
clamped_likelihood = result.over_target_likelihood clamped_likelihood = result.over_target_likelihood
likelihoods.append(clamped_likelihood) likelihoods.append(clamped_likelihood)

View File

@@ -127,8 +127,11 @@ class SubsetSimulation:
next_dipoles_seed_dipoles = numpy.array([n[1] for n in next_seeds]) next_dipoles_seed_dipoles = numpy.array([n[1] for n in next_seeds])
for n in range(self.model.n): for n in range(self.model.n):
_logger.info(f"{next_dipoles_seed_dipoles[:, n].shape}") _logger.info(f"{next_dipoles_seed_dipoles[:, n].shape}")
numpy.savetxt(f"generation_{self.n_c}_{self.n_s}_{i}_dipole_{n}.csv", next_dipoles_seed_dipoles[:, n], delimiter=",") numpy.savetxt(
f"generation_{self.n_c}_{self.n_s}_{i}_dipole_{n}.csv",
next_dipoles_seed_dipoles[:, n],
delimiter=",",
)
if self.keep_probs_list: if self.keep_probs_list:
for cost_index, cost_chain in enumerate(all_chains[: -self.n_c]): for cost_index, cost_chain in enumerate(all_chains[: -self.n_c]):
@@ -187,7 +190,10 @@ class SubsetSimulation:
if self.keep_probs_list: if self.keep_probs_list:
probs_list.append( probs_list.append(
( (
((self.n_c * self.n_s - cost_index) / (self.n_c * self.n_s)) (
(self.n_c * self.n_s - cost_index)
/ (self.n_c * self.n_s)
)
/ (self.n_s ** (i)), / (self.n_s ** (i)),
cost_chain[0], cost_chain[0],
i + 1, i + 1,
@@ -234,7 +240,7 @@ class SubsetSimulation:
# _logger.info(f"\t{prob}: {prob_cost}") # _logger.info(f"\t{prob}: {prob_cost}")
probs_list.sort(key=lambda c: c[0], reverse=True) probs_list.sort(key=lambda c: c[0], reverse=True)
min_likelihood = ((1) / (self.n_c * self.n_s))/ (self.n_s ** (self.m_max + 1)) min_likelihood = ((1) / (self.n_c * self.n_s)) / (self.n_s ** (self.m_max + 1))
result = SubsetSimulationResult( result = SubsetSimulationResult(
probs_list=probs_list, probs_list=probs_list,