@@ -66,7 +66,7 @@ def sum_stat(cls, *args, **kwargs):
66
66
class Simulator (NoDistribution ):
67
67
r"""
68
68
Simulator distribution, used for Approximate Bayesian Inference (ABC)
69
- with Sequential Monte Carlo (SMC) sampling via ``pm .sample_smc` `.
69
+ with Sequential Monte Carlo (SMC) sampling via :func:`~pymc .sample_smc`.
70
70
71
71
Simulator distributions have a stochastic pseudo-loglikelihood defined by
72
72
a distance metric between the observed and simulated data, and tweaked
@@ -78,14 +78,17 @@ class Simulator(NoDistribution):
78
78
Python random simulator function. Should expect the following signature
79
79
``(rng, arg1, arg2, ... argn, size)``, where rng is a ``numpy.random.RandomStream()``
80
80
and ``size`` defines the size of the desired sample.
81
- params : list
82
- Parameters used by the Simulator random function. Parameters can also
83
- be passed by order, in which case the keyword argument ``params`` is
84
- ignored. Alternatively, each parameter can be passed by order after fn,
85
- ``param1, param2, ..., paramN``
86
- distance : Aesara Op, callable or str
87
- Distance function. Available options are ``"gaussian"`` (default), ``"laplace"``,
88
- ``"kullback_leibler"`` or a user defined function (or Aesara Op) that takes
81
+ *unnamed_params : list of TensorVariable
82
+ Parameters used by the Simulator random function. Each parameter can be passed
83
+ by order after fn, for example ``param1, param2, ..., paramN``. params can also
84
+ be passed with keyword argument "params".
85
+ params : list of TensorVariable
86
+ Keyword form of ''unnamed_params''.
87
+ One of unnamed_params or params must be provided.
88
+ If passed both unnamed_params and params, an error is raised.
89
+ distance : Aesara_Op, callable or str, default "gaussian"
90
+ Distance function. Available options are ``"gaussian"``, ``"laplace"``,
91
+ ``"kullback_leibler"`` or a user defined function (or Aesara_Op) that takes
89
92
``epsilon``, the summary statistics of observed_data and the summary statistics
90
93
of simulated_data as input.
91
94
@@ -98,20 +101,19 @@ class Simulator(NoDistribution):
98
101
``distance="gaussian"`` + ``sum_stat="sort"`` is equivalent to the 1D 2-wasserstein distance
99
102
100
103
``distance="laplace"`` + ``sum_stat="sort"`` is equivalent to the the 1D 1-wasserstein distance
101
- sum_stat : Aesara Op , callable or str
102
- Summary statistic function. Available options are ``"indentity "`` (default) ,
103
- ``"sort"``, ``"mean"``, ``"median"``. If a callable (or Aesara Op ) is defined,
104
+ sum_stat : Aesara_Op , callable or str, default "identity"
105
+ Summary statistic function. Available options are ``"identity "``,
106
+ ``"sort"``, ``"mean"``, ``"median"``. If a callable (or Aesara_Op ) is defined,
104
107
it should return a 1d numpy array (or Aesara vector).
105
- epsilon : float or array
108
+ epsilon : tensor_like of float, default 1.0
106
109
Scaling parameter for the distance functions. It should be a float or
107
- an array of the same size of the output of ``sum_stat``. Defaults to ``1.0``
108
- ndim_supp : int
110
+ an array of the same size of the output of ``sum_stat``.
111
+ ndim_supp : int, default 0
109
112
Number of dimensions of the SimulatorRV (0 for scalar, 1 for vector, etc.)
110
- Defaults to ``0``.
111
- ndims_params : list[int]
113
+ ndims_params : list of int, optional
112
114
Number of minimum dimensions of each parameter of the RV. For example,
113
115
if the Simulator accepts two scalar inputs, it should be ``[0, 0]``.
114
- Defaults to ``0`` for each parameter .
116
+ Default to list of 0 with length equal to the number of parameters .
115
117
116
118
Examples
117
119
--------
@@ -158,7 +160,7 @@ def __new__(
158
160
elif distance == "kullback_leibler" :
159
161
raise NotImplementedError ("KL not refactored yet" )
160
162
# TODO: Wrap KL in aesara OP
161
- # distance = KullbackLiebler (observed)
163
+ # distance = KullbackLeibler (observed)
162
164
# if sum_stat != "identity":
163
165
# _log.info(f"Automatically setting sum_stat to identity as expected by {distance}")
164
166
# sum_stat = "identity"
@@ -273,8 +275,8 @@ def laplace(epsilon, obs_data, sim_data):
273
275
return - at .abs_ ((obs_data - sim_data ) / epsilon )
274
276
275
277
276
- class KullbackLiebler :
277
- """Approximate Kullback-Liebler ."""
278
+ class KullbackLeibler :
279
+ """Approximate Kullback-Leibler ."""
278
280
279
281
def __init__ (self , obs_data ):
280
282
if obs_data .ndim == 1 :
0 commit comments