From 5cc5f7c85aca31424e0914bd2866c1a5e5072a4e Mon Sep 17 00:00:00 2001 From: LarsKue Date: Fri, 28 Mar 2025 11:23:45 +0100 Subject: [PATCH 01/15] add adapter docs --- bayesflow/adapters/__init__.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/bayesflow/adapters/__init__.py b/bayesflow/adapters/__init__.py index 1fbd0d81a..5fc723920 100644 --- a/bayesflow/adapters/__init__.py +++ b/bayesflow/adapters/__init__.py @@ -1,3 +1,7 @@ +""" +A collection of :py:class:`~bayesflow.adapters.Adapter` transforms, which tell BayesFlow how to interpret your :py:class:`~bayesflow.simulators.Simulator` output and plug it into neural networks for training and inference. +""" + from . import transforms from .adapter import Adapter From 1d13777d04511c778148b35c1d1fbc8c9f076cbf Mon Sep 17 00:00:00 2001 From: LarsKue Date: Fri, 28 Mar 2025 11:23:59 +0100 Subject: [PATCH 02/15] add approximator docs --- bayesflow/approximators/__init__.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/bayesflow/approximators/__init__.py b/bayesflow/approximators/__init__.py index 737336dc0..55e64ea86 100644 --- a/bayesflow/approximators/__init__.py +++ b/bayesflow/approximators/__init__.py @@ -1,3 +1,7 @@ +""" +A collection of :py:class:`~bayesflow.approximators.Approximator`\ s, which embody the inference task and the neural network components used to perform it. +""" + from .approximator import Approximator from .continuous_approximator import ContinuousApproximator from .point_approximator import PointApproximator From e1933ce6c128be7e68a651e6cc3f33c6d8f82f81 Mon Sep 17 00:00:00 2001 From: LarsKue Date: Fri, 28 Mar 2025 11:24:14 +0100 Subject: [PATCH 03/15] add dataset docs --- bayesflow/datasets/__init__.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/bayesflow/datasets/__init__.py b/bayesflow/datasets/__init__.py index b540c0c65..8bd704010 100644 --- a/bayesflow/datasets/__init__.py +++ b/bayesflow/datasets/__init__.py @@ -1,3 +1,7 @@ +""" +A collection of `keras.utils.PyDataset `__\ s, which wrap your data-generating process (i.e., your :py:class:`~bayesflow.simulators.Simulator`). +What type of Dataset you use determines the effective training strategy (e.g., online or offline). +""" from .offline_dataset import OfflineDataset from .online_dataset import OnlineDataset from .disk_dataset import DiskDataset From fee88f4d32213e2fdea85d983784031097f28674 Mon Sep 17 00:00:00 2001 From: LarsKue Date: Fri, 28 Mar 2025 11:24:38 +0100 Subject: [PATCH 04/15] add dataset docs --- bayesflow/diagnostics/__init__.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/bayesflow/diagnostics/__init__.py b/bayesflow/diagnostics/__init__.py index c0e0efc6d..8d1b54fc8 100644 --- a/bayesflow/diagnostics/__init__.py +++ b/bayesflow/diagnostics/__init__.py @@ -1,3 +1,6 @@ +""" +A collection of plotting utilities and metrics for evaluating trained :py:class:`~bayesflow.workflows.Workflow`\ s. +""" from .metrics import root_mean_squared_error, calibration_error, posterior_contraction from .plots import ( From 0b85492e48c05fb9bc9646e60a259902b2b9bbc4 Mon Sep 17 00:00:00 2001 From: LarsKue Date: Fri, 28 Mar 2025 11:24:49 +0100 Subject: [PATCH 05/15] add distribution docs --- bayesflow/distributions/__init__.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/bayesflow/distributions/__init__.py b/bayesflow/distributions/__init__.py index afe63b3a0..ba04f937a 100644 --- a/bayesflow/distributions/__init__.py +++ b/bayesflow/distributions/__init__.py @@ -1,3 +1,8 @@ +""" +A collection of :py:class:`~bayesflow.distributions.Distribution`\ s, +which represent the latent space for :py:class:`~bayesflow.networks.InferenceNetwork`\ s +or the summary space of :py:class:`~bayesflow.networks.SummaryNetwork`\ s. +""" from .distribution import Distribution from .diagonal_normal import DiagonalNormal from .diagonal_student_t import DiagonalStudentT From 04ab700d9fa7265fce6383ec5b46663a035d5f43 Mon Sep 17 00:00:00 2001 From: LarsKue Date: Fri, 28 Mar 2025 11:25:12 +0100 Subject: [PATCH 06/15] add experimental docs (for some reason these don't show correctly) --- bayesflow/experimental/__init__.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/bayesflow/experimental/__init__.py b/bayesflow/experimental/__init__.py index 8364aab92..6c2e02cbc 100644 --- a/bayesflow/experimental/__init__.py +++ b/bayesflow/experimental/__init__.py @@ -1,3 +1,6 @@ +""" +Unstable or largely untested networks. Proceed with caution. +""" from .cif import CIF from .continuous_time_consistency_model import ContinuousTimeConsistencyModel from .free_form_flow import FreeFormFlow From 444ff6635eba331ed085c4978724473a030bd120 Mon Sep 17 00:00:00 2001 From: LarsKue Date: Fri, 28 Mar 2025 11:25:25 +0100 Subject: [PATCH 07/15] add metrics docs --- bayesflow/metrics/__init__.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/bayesflow/metrics/__init__.py b/bayesflow/metrics/__init__.py index 41954ab02..f842c2d34 100644 --- a/bayesflow/metrics/__init__.py +++ b/bayesflow/metrics/__init__.py @@ -1,3 +1,7 @@ +""" +A collection of `keras.Metric `__\ s for evaluating the performance of models. +""" + from . import functional from .maximum_mean_discrepancy import MaximumMeanDiscrepancy from .root_mean_squard_error import RootMeanSquaredError From 495c6024c7619eadf52a6b702e728254aeeb897e Mon Sep 17 00:00:00 2001 From: LarsKue Date: Fri, 28 Mar 2025 11:25:36 +0100 Subject: [PATCH 08/15] add networks docs --- bayesflow/networks/__init__.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/bayesflow/networks/__init__.py b/bayesflow/networks/__init__.py index 573351e1d..d8a161095 100644 --- a/bayesflow/networks/__init__.py +++ b/bayesflow/networks/__init__.py @@ -1,3 +1,6 @@ +""" +A rich collection of neural network architectures for use in :py:class:`~bayesflow.approximators.Approximator`\ s. +""" from .consistency_models import ConsistencyModel from .coupling_flow import CouplingFlow from .deep_set import DeepSet From 9c242467dccd3ee35cf3593614a82c45d6e8469d Mon Sep 17 00:00:00 2001 From: LarsKue Date: Fri, 28 Mar 2025 11:25:46 +0100 Subject: [PATCH 09/15] add simulators docs --- bayesflow/simulators/__init__.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/bayesflow/simulators/__init__.py b/bayesflow/simulators/__init__.py index a9eee4fa7..037894f7e 100644 --- a/bayesflow/simulators/__init__.py +++ b/bayesflow/simulators/__init__.py @@ -1,3 +1,8 @@ +""" +This module provides the :py:class:`~bayesflow.simulators.Simulator`, which is the base implementation of a generative mathematical model, data generating process. +Its primary function is to sample data with the :py:meth:`~bayesflow.simulators.Simulator.sample` method. +The module also contains several other kinds of Simulators, as well as the function :py:func:`~bayesflow.simulators.make_simulator` to facilitate easy implementation. +""" from .sequential_simulator import SequentialSimulator from .hierarchical_simulator import HierarchicalSimulator from .lambda_simulator import LambdaSimulator From 722d532acb9c7d056f510441b776101ae507e405 Mon Sep 17 00:00:00 2001 From: LarsKue Date: Fri, 28 Mar 2025 11:25:58 +0100 Subject: [PATCH 10/15] modify types docs --- bayesflow/types/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bayesflow/types/__init__.py b/bayesflow/types/__init__.py index 49398163e..881956bfc 100644 --- a/bayesflow/types/__init__.py +++ b/bayesflow/types/__init__.py @@ -1,5 +1,5 @@ """ -Custom types. +Custom types used for type annotations. .. currentmodule:: bayesflow.types From ba0e3bf1f91ff12671b5aac6c385711213646671 Mon Sep 17 00:00:00 2001 From: LarsKue Date: Fri, 28 Mar 2025 11:26:21 +0100 Subject: [PATCH 11/15] add utils docs --- bayesflow/utils/__init__.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/bayesflow/utils/__init__.py b/bayesflow/utils/__init__.py index ecb546eae..3f5e4acbc 100644 --- a/bayesflow/utils/__init__.py +++ b/bayesflow/utils/__init__.py @@ -1,3 +1,7 @@ +""" +A collection of utility functions, mostly used for internal purposes. +""" + from . import ( keras_utils, logging, From fcfbec0d6bfa403722551f4a6abcab1c235ee87e Mon Sep 17 00:00:00 2001 From: LarsKue Date: Fri, 28 Mar 2025 11:26:32 +0100 Subject: [PATCH 12/15] add workflows docs --- bayesflow/workflows/__init__.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/bayesflow/workflows/__init__.py b/bayesflow/workflows/__init__.py index 63fc49c9c..6f0b7b8fe 100644 --- a/bayesflow/workflows/__init__.py +++ b/bayesflow/workflows/__init__.py @@ -1,3 +1,6 @@ +""" +Provides :py:class:`~bayesflow.workflows.BasicWorkflow`, a high-level interface for working on typical BayesFlow applications without having to worry about the internals. +""" from .basic_workflow import BasicWorkflow from ..utils._docs import _add_imports_to_all From faea1869c58d1d667f41870479ba717c66d83217 Mon Sep 17 00:00:00 2001 From: LarsKue Date: Fri, 28 Mar 2025 11:27:16 +0100 Subject: [PATCH 13/15] runn formatter --- bayesflow/datasets/__init__.py | 1 + bayesflow/diagnostics/__init__.py | 1 + bayesflow/distributions/__init__.py | 1 + bayesflow/experimental/__init__.py | 1 + bayesflow/networks/__init__.py | 1 + bayesflow/simulators/__init__.py | 1 + bayesflow/workflows/__init__.py | 1 + 7 files changed, 7 insertions(+) diff --git a/bayesflow/datasets/__init__.py b/bayesflow/datasets/__init__.py index 8bd704010..f7b774ace 100644 --- a/bayesflow/datasets/__init__.py +++ b/bayesflow/datasets/__init__.py @@ -2,6 +2,7 @@ A collection of `keras.utils.PyDataset `__\ s, which wrap your data-generating process (i.e., your :py:class:`~bayesflow.simulators.Simulator`). What type of Dataset you use determines the effective training strategy (e.g., online or offline). """ + from .offline_dataset import OfflineDataset from .online_dataset import OnlineDataset from .disk_dataset import DiskDataset diff --git a/bayesflow/diagnostics/__init__.py b/bayesflow/diagnostics/__init__.py index 8d1b54fc8..1e13e11f2 100644 --- a/bayesflow/diagnostics/__init__.py +++ b/bayesflow/diagnostics/__init__.py @@ -1,6 +1,7 @@ """ A collection of plotting utilities and metrics for evaluating trained :py:class:`~bayesflow.workflows.Workflow`\ s. """ + from .metrics import root_mean_squared_error, calibration_error, posterior_contraction from .plots import ( diff --git a/bayesflow/distributions/__init__.py b/bayesflow/distributions/__init__.py index ba04f937a..d56bd00fd 100644 --- a/bayesflow/distributions/__init__.py +++ b/bayesflow/distributions/__init__.py @@ -3,6 +3,7 @@ which represent the latent space for :py:class:`~bayesflow.networks.InferenceNetwork`\ s or the summary space of :py:class:`~bayesflow.networks.SummaryNetwork`\ s. """ + from .distribution import Distribution from .diagonal_normal import DiagonalNormal from .diagonal_student_t import DiagonalStudentT diff --git a/bayesflow/experimental/__init__.py b/bayesflow/experimental/__init__.py index 6c2e02cbc..908148a73 100644 --- a/bayesflow/experimental/__init__.py +++ b/bayesflow/experimental/__init__.py @@ -1,6 +1,7 @@ """ Unstable or largely untested networks. Proceed with caution. """ + from .cif import CIF from .continuous_time_consistency_model import ContinuousTimeConsistencyModel from .free_form_flow import FreeFormFlow diff --git a/bayesflow/networks/__init__.py b/bayesflow/networks/__init__.py index d8a161095..aba5ddc27 100644 --- a/bayesflow/networks/__init__.py +++ b/bayesflow/networks/__init__.py @@ -1,6 +1,7 @@ """ A rich collection of neural network architectures for use in :py:class:`~bayesflow.approximators.Approximator`\ s. """ + from .consistency_models import ConsistencyModel from .coupling_flow import CouplingFlow from .deep_set import DeepSet diff --git a/bayesflow/simulators/__init__.py b/bayesflow/simulators/__init__.py index 037894f7e..39d673fb2 100644 --- a/bayesflow/simulators/__init__.py +++ b/bayesflow/simulators/__init__.py @@ -3,6 +3,7 @@ Its primary function is to sample data with the :py:meth:`~bayesflow.simulators.Simulator.sample` method. The module also contains several other kinds of Simulators, as well as the function :py:func:`~bayesflow.simulators.make_simulator` to facilitate easy implementation. """ + from .sequential_simulator import SequentialSimulator from .hierarchical_simulator import HierarchicalSimulator from .lambda_simulator import LambdaSimulator diff --git a/bayesflow/workflows/__init__.py b/bayesflow/workflows/__init__.py index 6f0b7b8fe..76e27dea4 100644 --- a/bayesflow/workflows/__init__.py +++ b/bayesflow/workflows/__init__.py @@ -1,6 +1,7 @@ """ Provides :py:class:`~bayesflow.workflows.BasicWorkflow`, a high-level interface for working on typical BayesFlow applications without having to worry about the internals. """ + from .basic_workflow import BasicWorkflow from ..utils._docs import _add_imports_to_all From b418cf61f8380e04aef465c1fa044810d07b08f2 Mon Sep 17 00:00:00 2001 From: LarsKue Date: Fri, 28 Mar 2025 11:29:22 +0100 Subject: [PATCH 14/15] conform to line length limit --- bayesflow/adapters/__init__.py | 3 ++- bayesflow/approximators/__init__.py | 3 ++- bayesflow/datasets/__init__.py | 3 ++- bayesflow/metrics/__init__.py | 3 ++- bayesflow/simulators/__init__.py | 6 ++++-- bayesflow/workflows/__init__.py | 3 ++- 6 files changed, 14 insertions(+), 7 deletions(-) diff --git a/bayesflow/adapters/__init__.py b/bayesflow/adapters/__init__.py index 5fc723920..bb6c60b37 100644 --- a/bayesflow/adapters/__init__.py +++ b/bayesflow/adapters/__init__.py @@ -1,5 +1,6 @@ """ -A collection of :py:class:`~bayesflow.adapters.Adapter` transforms, which tell BayesFlow how to interpret your :py:class:`~bayesflow.simulators.Simulator` output and plug it into neural networks for training and inference. +A collection of :py:class:`~bayesflow.adapters.Adapter` transforms, which tell BayesFlow how to interpret your +:py:class:`~bayesflow.simulators.Simulator` output and plug it into neural networks for training and inference. """ from . import transforms diff --git a/bayesflow/approximators/__init__.py b/bayesflow/approximators/__init__.py index 55e64ea86..41099a8d1 100644 --- a/bayesflow/approximators/__init__.py +++ b/bayesflow/approximators/__init__.py @@ -1,5 +1,6 @@ """ -A collection of :py:class:`~bayesflow.approximators.Approximator`\ s, which embody the inference task and the neural network components used to perform it. +A collection of :py:class:`~bayesflow.approximators.Approximator`\ s, which embody the inference task and the +neural network components used to perform it. """ from .approximator import Approximator diff --git a/bayesflow/datasets/__init__.py b/bayesflow/datasets/__init__.py index f7b774ace..4150e68d6 100644 --- a/bayesflow/datasets/__init__.py +++ b/bayesflow/datasets/__init__.py @@ -1,5 +1,6 @@ """ -A collection of `keras.utils.PyDataset `__\ s, which wrap your data-generating process (i.e., your :py:class:`~bayesflow.simulators.Simulator`). +A collection of `keras.utils.PyDataset `__\ s, which +wrap your data-generating process (i.e., your :py:class:`~bayesflow.simulators.Simulator`). What type of Dataset you use determines the effective training strategy (e.g., online or offline). """ diff --git a/bayesflow/metrics/__init__.py b/bayesflow/metrics/__init__.py index f842c2d34..81c37bc40 100644 --- a/bayesflow/metrics/__init__.py +++ b/bayesflow/metrics/__init__.py @@ -1,5 +1,6 @@ """ -A collection of `keras.Metric `__\ s for evaluating the performance of models. +A collection of `keras.Metric `__\ s for evaluating the +performance of models. """ from . import functional diff --git a/bayesflow/simulators/__init__.py b/bayesflow/simulators/__init__.py index 39d673fb2..ba8204f3c 100644 --- a/bayesflow/simulators/__init__.py +++ b/bayesflow/simulators/__init__.py @@ -1,7 +1,9 @@ """ -This module provides the :py:class:`~bayesflow.simulators.Simulator`, which is the base implementation of a generative mathematical model, data generating process. +This module provides the :py:class:`~bayesflow.simulators.Simulator`, which is the base implementation of a +generative mathematical model, or data generating process. Its primary function is to sample data with the :py:meth:`~bayesflow.simulators.Simulator.sample` method. -The module also contains several other kinds of Simulators, as well as the function :py:func:`~bayesflow.simulators.make_simulator` to facilitate easy implementation. +The module also contains several other kinds of Simulators, as well as the function +:py:func:`~bayesflow.simulators.make_simulator` to facilitate easy implementation. """ from .sequential_simulator import SequentialSimulator diff --git a/bayesflow/workflows/__init__.py b/bayesflow/workflows/__init__.py index 76e27dea4..f50c7b1b6 100644 --- a/bayesflow/workflows/__init__.py +++ b/bayesflow/workflows/__init__.py @@ -1,5 +1,6 @@ """ -Provides :py:class:`~bayesflow.workflows.BasicWorkflow`, a high-level interface for working on typical BayesFlow applications without having to worry about the internals. +Provides :py:class:`~bayesflow.workflows.BasicWorkflow`, a high-level interface for working on typical BayesFlow +applications without having to worry about the internals. """ from .basic_workflow import BasicWorkflow From d2afd05a7cb83dbc14a03293ab265a17c670bb5c Mon Sep 17 00:00:00 2001 From: LarsKue Date: Mon, 31 Mar 2025 17:54:31 +0200 Subject: [PATCH 15/15] improve doc summaries (first sentence) --- bayesflow/datasets/__init__.py | 4 ++-- bayesflow/experimental/__init__.py | 2 +- bayesflow/simulators/__init__.py | 8 +++----- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/bayesflow/datasets/__init__.py b/bayesflow/datasets/__init__.py index 4150e68d6..2f4d21a69 100644 --- a/bayesflow/datasets/__init__.py +++ b/bayesflow/datasets/__init__.py @@ -1,7 +1,7 @@ """ A collection of `keras.utils.PyDataset `__\ s, which -wrap your data-generating process (i.e., your :py:class:`~bayesflow.simulators.Simulator`). -What type of Dataset you use determines the effective training strategy (e.g., online or offline). +wrap your data-generating process (i.e., your :py:class:`~bayesflow.simulators.Simulator`) and thus determine the +effective training strategy (e.g., online or offline). """ from .offline_dataset import OfflineDataset diff --git a/bayesflow/experimental/__init__.py b/bayesflow/experimental/__init__.py index 908148a73..4c6f80848 100644 --- a/bayesflow/experimental/__init__.py +++ b/bayesflow/experimental/__init__.py @@ -1,5 +1,5 @@ """ -Unstable or largely untested networks. Proceed with caution. +Unstable or largely untested networks, proceed with caution. """ from .cif import CIF diff --git a/bayesflow/simulators/__init__.py b/bayesflow/simulators/__init__.py index ba8204f3c..3b4c40050 100644 --- a/bayesflow/simulators/__init__.py +++ b/bayesflow/simulators/__init__.py @@ -1,9 +1,7 @@ """ -This module provides the :py:class:`~bayesflow.simulators.Simulator`, which is the base implementation of a -generative mathematical model, or data generating process. -Its primary function is to sample data with the :py:meth:`~bayesflow.simulators.Simulator.sample` method. -The module also contains several other kinds of Simulators, as well as the function -:py:func:`~bayesflow.simulators.make_simulator` to facilitate easy implementation. +This module provides :py:class:`~bayesflow.simulators.Simulator`, :py:function:`~bayesflow.simulators.make_simulator`, +and several other kinds of :py:class:`~bayesflow.simulators.Simulator` implementations, which serve as generative +mathematical models, or data generating processes, with their primary function being to sample data. """ from .sequential_simulator import SequentialSimulator