Skip to content

Commit 5eaa516

Browse files
ricardoV94twiecki
authored andcommitted
Update aesara and aeppl dependencies
1 parent b799547 commit 5eaa516

12 files changed

+32
-28
lines changed

conda-envs/environment-dev-py37.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ channels:
44
- conda-forge
55
- defaults
66
dependencies:
7-
- aeppl=0.0.26
8-
- aesara=2.4.0
7+
- aeppl=0.0.27
8+
- aesara=2.5.1
99
- arviz>=0.11.4
1010
- blas
1111
- cachetools>=4.2.1

conda-envs/environment-dev-py38.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ channels:
44
- conda-forge
55
- defaults
66
dependencies:
7-
- aeppl=0.0.26
8-
- aesara=2.4.0
7+
- aeppl=0.0.27
8+
- aesara=2.5.1
99
- arviz>=0.11.4
1010
- blas
1111
- cachetools>=4.2.1

conda-envs/environment-dev-py39.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ channels:
44
- conda-forge
55
- defaults
66
dependencies:
7-
- aeppl=0.0.26
8-
- aesara=2.4.0
7+
- aeppl=0.0.27
8+
- aesara=2.5.1
99
- arviz>=0.11.4
1010
- blas
1111
- cachetools>=4.2.1

conda-envs/environment-test-py37.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ channels:
44
- conda-forge
55
- defaults
66
dependencies:
7-
- aeppl=0.0.26
8-
- aesara=2.4.0
7+
- aeppl=0.0.27
8+
- aesara=2.5.1
99
- arviz>=0.11.4
1010
- blas
1111
- cachetools>=4.2.1

conda-envs/environment-test-py38.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ channels:
44
- conda-forge
55
- defaults
66
dependencies:
7-
- aeppl=0.0.26
8-
- aesara=2.4.0
7+
- aeppl=0.0.27
8+
- aesara=2.5.1
99
- arviz>=0.11.4
1010
- blas
1111
- cachetools>=4.2.1

conda-envs/environment-test-py39.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ channels:
44
- conda-forge
55
- defaults
66
dependencies:
7-
- aeppl=0.0.26
8-
- aesara=2.4.0
7+
- aeppl=0.0.27
8+
- aesara=2.5.1
99
- arviz>=0.11.4
1010
- blas
1111
- cachetools>=4.2.1

conda-envs/windows-environment-dev-py38.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ channels:
44
- defaults
55
dependencies:
66
# base dependencies (see install guide for Windows)
7-
- aeppl=0.0.26
8-
- aesara=2.4.0
7+
- aeppl=0.0.27
8+
- aesara=2.5.1
99
- arviz>=0.11.4
1010
- blas
1111
- cachetools>=4.2.1

conda-envs/windows-environment-test-py38.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ channels:
44
- defaults
55
dependencies:
66
# base dependencies (see install guide for Windows)
7-
- aeppl=0.0.26
8-
- aesara=2.4.0
7+
- aeppl=0.0.27
8+
- aesara=2.5.1
99
- arviz>=0.11.4
1010
- blas
1111
- cachetools>=4.2.1

docs/source/contributing/developer_guide_implementing_distribution.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ Some important things to keep in mind:
8888

8989
1. Everything inside the `rng_fn` method is pure Python code (as are the inputs) and should not make use of other `Aesara` symbolic ops. The random method should make use of the `rng` which is a Numpy {class}`~numpy.random.RandomState`, so that samples are reproducible.
9090
1. The `size` argument (together with the inputs shape) are the only way for the user to specify non-default `RandomVariable` dimensions. The `rng_fn` will have to take this into consideration for correct output. `size` is the specification used by `Numpy` and `Scipy` and works like PyMC `shape` for univariate distributions, but is different for multivariate distributions. Unfortunately there is no general reference documenting how `size` ought to work for multivariate distributions. This [discussion](https://github.com/numpy/numpy/issues/17669) may be helpful to get more context.
91-
1. `Aesara` tries to infer the output shape of the `RandomVariable` (given a user-specified size) by introspection of the `ndim_supp` and `ndim_params` attributes. However, the default method may not work for more complex distributions. In that case, custom `_shape_from_params` (and less probably, `_infer_shape`) should also be implemented in the new `RandomVariable` class. One simple example is seen in the {class}`~pymc.distributions.multivariate.DirichletMultinomialRV` where it was necessary to specify the `rep_param_idx` so that the `default_shape_from_params` helper method could do its job. In more complex cases, it may not be possible to make use of the default helper, but those have not been found yet!
91+
1. `Aesara` tries to infer the output shape of the `RandomVariable` (given a user-specified size) by introspection of the `ndim_supp` and `ndim_params` attributes. However, the default method may not work for more complex distributions. In that case, custom `_supp_shape_from_params` (and less probably, `_infer_shape`) should also be implemented in the new `RandomVariable` class. One simple example is seen in the {class}`~pymc.distributions.multivariate.DirichletMultinomialRV` where it was necessary to specify the `rep_param_idx` so that the `default_supp_shape_from_params` helper method could do its job. In more complex cases, it may not suffice to use this default helper. This could hapen for instance if the argument values determined the support shape of the distribution, as happens in the `~pymc.distribution.multivarite._LKJCholeskyCovRV`.
9292
1. It's okay to use the `rng_fn` `classmethods` of other Aesara and PyMC `RandomVariables` inside the new `rng_fn`. For example if you are implementing a negative HalfNormal `RandomVariable`, your `rng_fn` can simply return `- halfnormal.rng_fn(rng, scale, size)`.
9393

9494
*Note: In addition to `size`, the PyMC API also provides `shape` and `dims` as alternatives to define a distribution dimensionality, but this is taken care of by {class}`~pymc.distributions.Distribution`, and should not require any extra changes.*

pymc/distributions/multivariate.py

+11-7
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
from aesara.tensor import gammaln, sigmoid
3232
from aesara.tensor.nlinalg import det, eigh, matrix_inverse, trace
3333
from aesara.tensor.random.basic import MultinomialRV, dirichlet, multivariate_normal
34-
from aesara.tensor.random.op import RandomVariable, default_shape_from_params
34+
from aesara.tensor.random.op import RandomVariable, default_supp_shape_from_params
3535
from aesara.tensor.random.utils import broadcast_params
3636
from aesara.tensor.slinalg import Cholesky
3737
from aesara.tensor.slinalg import solve_lower_triangular as solve_lower
@@ -295,8 +295,10 @@ def __call__(self, nu, mu=None, cov=None, size=None, **kwargs):
295295
cov = np.array([[1.0]], dtype=dtype)
296296
return super().__call__(nu, mu, cov, size=size, **kwargs)
297297

298-
def _shape_from_params(self, dist_params, rep_param_idx=1, param_shapes=None):
299-
return default_shape_from_params(self.ndim_supp, dist_params, rep_param_idx, param_shapes)
298+
def _supp_shape_from_params(self, dist_params, rep_param_idx=1, param_shapes=None):
299+
return default_supp_shape_from_params(
300+
self.ndim_supp, dist_params, rep_param_idx, param_shapes
301+
)
300302

301303
@classmethod
302304
def rng_fn(cls, rng, nu, mu, cov, size):
@@ -607,8 +609,10 @@ class DirichletMultinomialRV(RandomVariable):
607609
dtype = "int64"
608610
_print_name = ("DirichletMN", "\\operatorname{DirichletMN}")
609611

610-
def _shape_from_params(self, dist_params, rep_param_idx=1, param_shapes=None):
611-
return default_shape_from_params(self.ndim_supp, dist_params, rep_param_idx, param_shapes)
612+
def _supp_shape_from_params(self, dist_params, rep_param_idx=1, param_shapes=None):
613+
return default_supp_shape_from_params(
614+
self.ndim_supp, dist_params, rep_param_idx, param_shapes
615+
)
612616

613617
@classmethod
614618
def rng_fn(cls, rng, n, a, size):
@@ -903,7 +907,7 @@ class WishartRV(RandomVariable):
903907
dtype = "floatX"
904908
_print_name = ("Wishart", "\\operatorname{Wishart}")
905909

906-
def _shape_from_params(self, dist_params, rep_param_idx=1, param_shapes=None):
910+
def _supp_shape_from_params(self, dist_params, rep_param_idx=1, param_shapes=None):
907911
# The shape of second parameter `V` defines the shape of the output.
908912
return dist_params[1].shape[-2:]
909913

@@ -1471,7 +1475,7 @@ def make_node(self, rng, size, dtype, n, eta):
14711475

14721476
return super().make_node(rng, size, dtype, n, eta)
14731477

1474-
def _shape_from_params(self, dist_params, **kwargs):
1478+
def _supp_shape_from_params(self, dist_params, **kwargs):
14751479
n = dist_params[0]
14761480
dist_shape = ((n * (n - 1)) // 2,)
14771481
return dist_shape

requirements-dev.txt

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# This file is auto-generated by scripts/generate_pip_deps_from_conda.py, do not modify.
22
# See that file for comments about the need/usage of each dependency.
33

4-
aeppl==0.0.26
5-
aesara==2.4.0
4+
aeppl==0.0.27
5+
aesara==2.5.1
66
arviz>=0.11.4
77
cachetools>=4.2.1
88
cloudpickle

requirements.txt

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
aeppl==0.0.26
2-
aesara==2.4.0
1+
aeppl==0.0.27
2+
aesara==2.5.1
33
arviz>=0.11.4
44
cachetools>=4.2.1
55
cloudpickle

0 commit comments

Comments
 (0)