Skip to content

Commit 1c40824

Browse files
pre-commit-ci[bot]twiecki
authored andcommitted
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent c5ad76a commit 1c40824

File tree

12 files changed

+12
-17
lines changed

12 files changed

+12
-17
lines changed

notebooks/discrete_markov_chain.ipynb

-1
Original file line numberDiff line numberDiff line change
@@ -568,7 +568,6 @@
568568
" ar_coefs = pm.Normal(\"coefs\", size=order, dims=[\"ar_params\"])\n",
569569
"\n",
570570
" def AR_step(s, L1_s, L2_s, L3_s, L4_s, L1_y, L2_y, L3_y, L4_y, mus, phis):\n",
571-
"\n",
572571
" y_out = (\n",
573572
" mus[s]\n",
574573
" + phis[0] * (L1_y - mus[L1_s])\n",

pymc_experimental/inference/pathfinder.py

-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ def convert_flat_trace_to_idata(
3535
postprocessing_backend="cpu",
3636
model=None,
3737
):
38-
3938
model = modelcontext(model)
4039
ip = model.initial_point()
4140
ip_point_map_info = pm.blocking.DictToArrayBijection.map(ip).point_map_info

pymc_experimental/statespace/filters/utilities.py

-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ def split_vars_into_seq_and_nonseq(params, param_names):
4040
seq_names, non_seq_names = [], []
4141

4242
for param, name in zip(params, param_names):
43-
4443
if decide_if_x_time_varies(param, name):
4544
sequences.append(param)
4645
seq_names.append(name)

pymc_experimental/statespace/models/VARMAX.py

-1
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,6 @@ def __init__(
148148
measurement_error: bool = False,
149149
verbose=True,
150150
):
151-
152151
if (endog_names is None) and (k_endog is None):
153152
raise ValueError("Must specify either endog_names or k_endog")
154153
if (endog_names is not None) and (k_endog is None):

pymc_experimental/statespace/models/structural.py

-1
Original file line numberDiff line numberDiff line change
@@ -1534,7 +1534,6 @@ def _get_state_names(self, k_exog, state_names, name):
15341534
return k_exog, state_names
15351535

15361536
def _handle_input_data(self, k_exog: int, state_names: Optional[List[str]], name) -> int:
1537-
15381537
k_exog, state_names = self._get_state_names(k_exog, state_names, name)
15391538
self.state_names = state_names
15401539

pymc_experimental/tests/model/test_marginal_model.py

+6-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,12 @@ def test_marginalized_bernoulli_logp():
5454

5555
idx = pm.Bernoulli.dist(0.7, name="idx")
5656
y = pm.Normal.dist(mu=mu[idx], sigma=1.0, name="y")
57-
marginal_rv_node = FiniteDiscreteMarginalRV([mu], [idx, y], ndim_supp=None, n_updates=0,)(
57+
marginal_rv_node = FiniteDiscreteMarginalRV(
58+
[mu],
59+
[idx, y],
60+
ndim_supp=None,
61+
n_updates=0,
62+
)(
5863
mu
5964
)[0].owner
6065

pymc_experimental/tests/statespace/test_SARIMAX.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,7 @@ def test_interpretable_states_are_interpretable(arima_mod_interp, pymc_mod_inter
339339
ma_lags = prior.prior.coords["ma_lag"].values - 1
340340

341341
# Check the first p states are lags of the previous state
342-
for (t, tm1) in zip(ar_lags[1:], ar_lags[:-1]):
342+
for t, tm1 in zip(ar_lags[1:], ar_lags[:-1]):
343343
assert_allclose(
344344
prior_outputs.prior_latent.isel(state=t).values[1:],
345345
prior_outputs.prior_latent.isel(state=tm1).values[:-1],
@@ -348,7 +348,7 @@ def test_interpretable_states_are_interpretable(arima_mod_interp, pymc_mod_inter
348348

349349
# Check the next p+q states are lags of the innovations
350350
n = len(ar_lags)
351-
for (t, tm1) in zip(ma_lags[1:], ma_lags[:-1]):
351+
for t, tm1 in zip(ma_lags[1:], ma_lags[:-1]):
352352
assert_allclose(
353353
prior_outputs.prior_latent.isel(state=n + t).values[1:],
354354
prior_outputs.prior_latent.isel(state=n + tm1).values[:-1],

pymc_experimental/tests/statespace/test_structural.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -177,8 +177,8 @@ def create_structural_model_and_equivalent_statsmodel(
177177
params = {}
178178
sm_params = {}
179179
sm_init = {}
180-
expected_param_dims = defaultdict(lambda: ())
181-
expected_coords = defaultdict(lambda: [])
180+
expected_param_dims = defaultdict(tuple)
181+
expected_coords = defaultdict(list)
182182
expected_param_dims["P0"] += ("state", "state_aux")
183183

184184
default_states = [
@@ -727,15 +727,15 @@ def test_add_components():
727727
se_mats = [se_T, se_R, se_Q]
728728
all_mats = [T, R, Q]
729729

730-
for (ll_mat, se_mat, all_mat) in zip(ll_mats, se_mats, all_mats):
730+
for ll_mat, se_mat, all_mat in zip(ll_mats, se_mats, all_mats):
731731
assert_allclose(all_mat, linalg.block_diag(ll_mat, se_mat), atol=ATOL, rtol=RTOL)
732732

733733
ll_mats = [ll_x0, ll_c, ll_Z]
734734
se_mats = [se_x0, se_c, se_Z]
735735
all_mats = [x0, c, Z]
736736
axes = [0, 0, 1]
737737

738-
for (ll_mat, se_mat, all_mat, axis) in zip(ll_mats, se_mats, all_mats, axes):
738+
for ll_mat, se_mat, all_mat, axis in zip(ll_mats, se_mats, all_mats, axes):
739739
assert_allclose(all_mat, np.concatenate([ll_mat, se_mat], axis=axis), atol=ATOL, rtol=RTOL)
740740

741741

pymc_experimental/tests/test_pathfinder.py

-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ def test_pathfinder():
2929
sigma = np.array([15.0, 10.0, 16.0, 11.0, 9.0, 11.0, 10.0, 18.0])
3030

3131
with pm.Model() as model:
32-
3332
mu = pm.Normal("mu", mu=0.0, sigma=10.0)
3433
tau = pm.HalfCauchy("tau", 5.0)
3534

pymc_experimental/utils/linear_cg.py

-2
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ def masked_fill(vector, mask, fill_value):
2828
def linear_cg_updates(
2929
result, alpha, residual_inner_prod, eps, beta, residual, precond_residual, curr_conjugate_vec
3030
):
31-
3231
# Everything inside _jit_linear_cg_updates
3332
result = result + alpha * curr_conjugate_vec
3433
beta = np.copy(residual_inner_prod)
@@ -68,7 +67,6 @@ def linear_cg(
6867
terminate_cg_by_size=False,
6968
use_eval_tolerange=False,
7069
):
71-
7270
if initial_guess is None:
7371
initial_guess = np.zeros_like(rhs)
7472

pymc_experimental/utils/pytensorf.py

-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ class StringConstant(Constant):
3636

3737
@pytensor._as_symbolic.register(str)
3838
def as_symbolic_string(x, **kwargs):
39-
4039
return StringConstant(stringtype, x)
4140

4241

setup.py

-1
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,6 @@ def read_version():
7777

7878

7979
if __name__ == "__main__":
80-
8180
setup(
8281
name="pymc-experimental",
8382
version=read_version(),

0 commit comments

Comments
 (0)