Skip to content

Commit 2668b61

Browse files
committed
refactor benchmarks into simulators
1 parent 11b6956 commit 2668b61

File tree

17 files changed

+15
-73
lines changed

17 files changed

+15
-73
lines changed

bayesflow/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
from . import (
22
approximators,
3-
benchmarks,
43
adapters,
54
datasets,
65
diagnostics,

bayesflow/benchmarks/__init__.py

Lines changed: 0 additions & 6 deletions
This file was deleted.

bayesflow/benchmarks/simulators/two_moons.py

Lines changed: 0 additions & 61 deletions
This file was deleted.

bayesflow/simulators/__init__.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,12 @@
44
from .make_simulator import make_simulator
55
from .model_comparison_simulator import ModelComparisonSimulator
66
from .simulator import Simulator
7-
from .two_moons import TwoMoons
7+
8+
from .benchmark_simulators import (
9+
LotkaVolterra,
10+
SIR,
11+
TwoMoons,
12+
)
813

914
from ..utils._docs import _add_imports_to_all
1015

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
1-
from .two_moons import TwoMoons
21
from .lotka_volterra import LotkaVolterra
2+
from .sir import SIR
3+
from .two_moons import TwoMoons

bayesflow/benchmarks/simulators/benchmark_simulator.py renamed to bayesflow/simulators/benchmark_simulators/benchmark_simulator.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,13 @@
22

33
from bayesflow.types import Shape
44
from bayesflow.utils import batched_call, tree_stack
5+
from bayesflow.utils.decorators import allow_batch_size
56

7+
from ..simulator import Simulator
68

7-
class BenchmarkSimulator:
9+
10+
class BenchmarkSimulator(Simulator):
11+
@allow_batch_size
812
def sample(self, batch_shape: Shape, **kwargs) -> dict[str, np.ndarray]:
913
"""Runs simulated benchmark and returns `batch_size` parameter
1014
and observation batches

0 commit comments

Comments
 (0)