Skip to content

Commit c053a94

Browse files
ricardoV94jessegrabowski
authored andcommitted
Bump minimum PyMC dependency
Do not use custom `SolveTriangular` `Op` in `kalman_filter.py`
1 parent 4500708 commit c053a94

File tree

9 files changed

+19
-16
lines changed

9 files changed

+19
-16
lines changed

.github/workflows/pypi.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
fetch-depth: 0
1818
- uses: actions/setup-python@v4
1919
with:
20-
python-version: 3.8
20+
python-version: "3.10"
2121
- name: Build the sdist and the wheel
2222
run: |
2323
pip install build
@@ -63,7 +63,7 @@ jobs:
6363
repository_url: https://test.pypi.org/legacy/
6464
- uses: actions/setup-python@v4
6565
with:
66-
python-version: 3.8
66+
python-version: "3.10"
6767
- name: Test pip install from test.pypi
6868
run: |
6969
python -m venv venv-test-pypi

.github/workflows/test.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
matrix:
2020
os: [ubuntu-latest]
2121
floatx: [float64]
22-
python-version: ["3.8"]
22+
python-version: ["3.9"]
2323
test-subset:
2424
- pymc_experimental/tests
2525
fail-fast: false
@@ -84,7 +84,7 @@ jobs:
8484
matrix:
8585
os: [windows-latest]
8686
floatx: [float32]
87-
python-version: ["3.10"]
87+
python-version: ["3.11"]
8888
test-subset:
8989
- pymc_experimental/tests
9090
fail-fast: false

conda-envs/environment-test.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@ dependencies:
1111
- xhistogram
1212
- statsmodels
1313
- pip:
14-
- pymc>=5.6.0 # CI was failing to resolve
14+
- pymc>=5.8.1 # CI was failing to resolve
1515
- blackjax
1616
- scikit-learn

conda-envs/windows-environment-test.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,5 @@ dependencies:
1010
- xhistogram
1111
- statsmodels
1212
- pip:
13-
- pymc>=5.6.0 # CI was failing to resolve
13+
- pymc>=5.8.1 # CI was failing to resolve
1414
- scikit-learn

pymc_experimental/distributions/continuous.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
from pymc.distributions.shape_utils import rv_size_is_none
2929
from pymc.pytensorf import floatX
3030
from pytensor.tensor.random.op import RandomVariable
31-
from pytensor.tensor.var import TensorVariable
31+
from pytensor.tensor.variable import TensorVariable
3232
from scipy import stats
3333

3434

pymc_experimental/distributions/histogram_utils.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -100,15 +100,15 @@ def histogram_approximation(name, dist, *, observed, **h_kwargs):
100100
----------
101101
name : str
102102
Name for the Potential
103-
dist : pytensor.tensor.var.TensorVariable
103+
dist : TensorVariable
104104
The output of pm.Distribution.dist()
105105
observed : ArrayLike
106106
Observed value to construct a histogram. Histogram is computed over 0th axis.
107107
Dask is supported.
108108
109109
Returns
110110
-------
111-
pytensor.tensor.var.TensorVariable
111+
TensorVariable
112112
Potential
113113
114114
Examples

pymc_experimental/gp/latent_approx.py

+6-2
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,16 @@
1111
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
14-
14+
from functools import partial
1515

1616
import numpy as np
1717
import pymc as pm
1818
import pytensor.tensor as pt
19-
from pymc.gp.util import JITTER_DEFAULT, cholesky, solve_lower, solve_upper, stabilize
19+
from pymc.gp.util import JITTER_DEFAULT, stabilize
20+
from pytensor.tensor.linalg import cholesky, solve_triangular
21+
22+
solve_lower = partial(solve_triangular, lower=True)
23+
solve_upper = partial(solve_triangular, lower=False)
2024

2125

2226
class LatentApprox(pm.gp.Latent):

pymc_experimental/statespace/filters/kalman_filter.py

+3-4
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
from pytensor.raise_op import Assert
1010
from pytensor.tensor import TensorVariable
1111
from pytensor.tensor.nlinalg import matrix_dot
12-
from pytensor.tensor.slinalg import SolveTriangular
12+
from pytensor.tensor.slinalg import solve_triangular
1313

1414
from pymc_experimental.statespace.filters.utilities import (
1515
quad_form_sym,
@@ -22,7 +22,6 @@
2222
MVN_CONST = pt.log(2 * pt.constant(np.pi, dtype="float64"))
2323
PARAM_NAMES = ["c", "d", "T", "Z", "R", "H", "Q"]
2424

25-
solve_lower_triangular = SolveTriangular(lower=True)
2625
assert_data_is_1d = Assert("UnivariateTimeSeries filter requires data be at most 1-dimensional")
2726
assert_time_varying_dim_correct = Assert(
2827
"The first dimension of a time varying matrix (the time dimension) must be "
@@ -684,13 +683,13 @@ def update(self, a, P, y, c, d, Z, H, all_nan_flag):
684683
F_chol = pt.linalg.cholesky(F)
685684

686685
# If everything is missing, K = 0, IKZ = I
687-
K = solve_lower_triangular(F_chol.T, solve_lower_triangular(F_chol, PZT.T)).T
686+
K = solve_triangular(F_chol.T, solve_triangular(F_chol, PZT.T)).T
688687
I_KZ = self.eye_states - K.dot(Z)
689688

690689
a_filtered = a + K.dot(v)
691690
P_filtered = quad_form_sym(I_KZ, P) + quad_form_sym(K, H)
692691

693-
inner_term = solve_lower_triangular(F_chol.T, solve_lower_triangular(F_chol, v))
692+
inner_term = solve_triangular(F_chol.T, solve_triangular(F_chol, v))
694693
n = y.shape[0]
695694

696695
ll = pt.switch(

requirements.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
pymc>=5.6.0
1+
pymc>=5.8.1
22
scikit-learn

0 commit comments

Comments
 (0)