flowMC 0.3.3__tar.gz → 0.3.4__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {flowmc-0.3.3/src/flowMC.egg-info → flowmc-0.3.4}/PKG-INFO +1 -1
- {flowmc-0.3.3 → flowmc-0.3.4}/setup.cfg +1 -1
- {flowmc-0.3.3 → flowmc-0.3.4}/src/flowMC/Sampler.py +44 -1
- {flowmc-0.3.3 → flowmc-0.3.4}/src/flowMC/nfmodel/base.py +1 -1
- {flowmc-0.3.3 → flowmc-0.3.4/src/flowMC.egg-info}/PKG-INFO +1 -1
- {flowmc-0.3.3 → flowmc-0.3.4}/LICENSE +0 -0
- {flowmc-0.3.3 → flowmc-0.3.4}/README.md +0 -0
- {flowmc-0.3.3 → flowmc-0.3.4}/pyproject.toml +0 -0
- {flowmc-0.3.3 → flowmc-0.3.4}/src/flowMC/__init__.py +0 -0
- {flowmc-0.3.3 → flowmc-0.3.4}/src/flowMC/nfmodel/__init__.py +0 -0
- {flowmc-0.3.3 → flowmc-0.3.4}/src/flowMC/nfmodel/common.py +0 -0
- {flowmc-0.3.3 → flowmc-0.3.4}/src/flowMC/nfmodel/realNVP.py +0 -0
- {flowmc-0.3.3 → flowmc-0.3.4}/src/flowMC/nfmodel/rqSpline.py +0 -0
- {flowmc-0.3.3 → flowmc-0.3.4}/src/flowMC/proposal/Gaussian_random_walk.py +0 -0
- {flowmc-0.3.3 → flowmc-0.3.4}/src/flowMC/proposal/HMC.py +0 -0
- {flowmc-0.3.3 → flowmc-0.3.4}/src/flowMC/proposal/MALA.py +0 -0
- {flowmc-0.3.3 → flowmc-0.3.4}/src/flowMC/proposal/NF_proposal.py +0 -0
- {flowmc-0.3.3 → flowmc-0.3.4}/src/flowMC/proposal/__init__.py +0 -0
- {flowmc-0.3.3 → flowmc-0.3.4}/src/flowMC/proposal/base.py +0 -0
- {flowmc-0.3.3 → flowmc-0.3.4}/src/flowMC/proposal/flowHMC.py +0 -0
- {flowmc-0.3.3 → flowmc-0.3.4}/src/flowMC/strategy/__init__.py +0 -0
- {flowmc-0.3.3 → flowmc-0.3.4}/src/flowMC/strategy/base.py +0 -0
- {flowmc-0.3.3 → flowmc-0.3.4}/src/flowMC/strategy/global_tuning.py +0 -0
- {flowmc-0.3.3 → flowmc-0.3.4}/src/flowMC/strategy/importance_sampling.py +0 -0
- {flowmc-0.3.3 → flowmc-0.3.4}/src/flowMC/strategy/optimization.py +0 -0
- {flowmc-0.3.3 → flowmc-0.3.4}/src/flowMC/utils/EvolutionaryOptimizer.py +0 -0
- {flowmc-0.3.3 → flowmc-0.3.4}/src/flowMC/utils/PythonFunctionWrap.py +0 -0
- {flowmc-0.3.3 → flowmc-0.3.4}/src/flowMC/utils/__init__.py +0 -0
- {flowmc-0.3.3 → flowmc-0.3.4}/src/flowMC/utils/postprocessing.py +0 -0
- {flowmc-0.3.3 → flowmc-0.3.4}/src/flowMC.egg-info/SOURCES.txt +0 -0
- {flowmc-0.3.3 → flowmc-0.3.4}/src/flowMC.egg-info/dependency_links.txt +0 -0
- {flowmc-0.3.3 → flowmc-0.3.4}/src/flowMC.egg-info/requires.txt +0 -0
- {flowmc-0.3.3 → flowmc-0.3.4}/src/flowMC.egg-info/top_level.txt +0 -0
|
@@ -271,7 +271,7 @@ class Sampler:
|
|
|
271
271
|
Args:
|
|
272
272
|
path (str): Path to save the normalizing flow.
|
|
273
273
|
"""
|
|
274
|
-
self.nf_model.load_model(path)
|
|
274
|
+
self.nf_model = self.nf_model.load_model(path)
|
|
275
275
|
|
|
276
276
|
def reset(self):
|
|
277
277
|
"""
|
|
@@ -388,3 +388,46 @@ class Sampler:
|
|
|
388
388
|
"""
|
|
389
389
|
with open(path, "wb") as f:
|
|
390
390
|
pickle.dump(self.summary, f)
|
|
391
|
+
|
|
392
|
+
def print_summary(self) -> None:
|
|
393
|
+
"""
|
|
394
|
+
Print summary to the screen about log probabilities and local/global acceptance rates.
|
|
395
|
+
"""
|
|
396
|
+
train_summary = self.get_sampler_state(training=True)
|
|
397
|
+
production_summary = self.get_sampler_state(training=False)
|
|
398
|
+
|
|
399
|
+
training_log_prob = train_summary["log_prob"]
|
|
400
|
+
training_local_acceptance = train_summary["local_accs"]
|
|
401
|
+
training_global_acceptance = train_summary["global_accs"]
|
|
402
|
+
training_loss = train_summary["loss_vals"]
|
|
403
|
+
|
|
404
|
+
production_log_prob = production_summary["log_prob"]
|
|
405
|
+
production_local_acceptance = production_summary["local_accs"]
|
|
406
|
+
production_global_acceptance = production_summary["global_accs"]
|
|
407
|
+
|
|
408
|
+
print("Training summary")
|
|
409
|
+
print("=" * 10)
|
|
410
|
+
print(
|
|
411
|
+
f"Log probability: {training_log_prob.mean():.3f} +/- {training_log_prob.std():.3f}"
|
|
412
|
+
)
|
|
413
|
+
print(
|
|
414
|
+
f"Local acceptance: {training_local_acceptance.mean():.3f} +/- {training_local_acceptance.std():.3f}"
|
|
415
|
+
)
|
|
416
|
+
print(
|
|
417
|
+
f"Global acceptance: {training_global_acceptance.mean():.3f} +/- {training_global_acceptance.std():.3f}"
|
|
418
|
+
)
|
|
419
|
+
print(
|
|
420
|
+
f"Max loss: {training_loss.max():.3f}, Min loss: {training_loss.min():.3f}"
|
|
421
|
+
)
|
|
422
|
+
|
|
423
|
+
print("Production summary")
|
|
424
|
+
print("=" * 10)
|
|
425
|
+
print(
|
|
426
|
+
f"Log probability: {production_log_prob.mean():.3f} +/- {production_log_prob.std():.3f}"
|
|
427
|
+
)
|
|
428
|
+
print(
|
|
429
|
+
f"Local acceptance: {production_local_acceptance.mean():.3f} +/- {production_local_acceptance.std():.3f}"
|
|
430
|
+
)
|
|
431
|
+
print(
|
|
432
|
+
f"Global acceptance: {production_global_acceptance.mean():.3f} +/- {production_global_acceptance.std():.3f}"
|
|
433
|
+
)
|
|
@@ -78,7 +78,7 @@ class NFModel(eqx.Module):
|
|
|
78
78
|
eqx.tree_serialise_leaves(path + ".eqx", self)
|
|
79
79
|
|
|
80
80
|
def load_model(self, path: str):
|
|
81
|
-
|
|
81
|
+
return eqx.tree_deserialise_leaves(path + ".eqx", self)
|
|
82
82
|
|
|
83
83
|
@eqx.filter_value_and_grad
|
|
84
84
|
def loss_fn(self, x):
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|