Skip to content

Commit

Permalink
updated np.product to np.prod (#2249)
Browse files Browse the repository at this point in the history
* updated np.product to np.prod

changed np.product to np.prod in 3 files

* added pull request changes in changelog

* fix pr link in CHANGELOG.md

---------

Co-authored-by: Oriol Abril-Pla <oriol.abril.pla@gmail.com>
  • Loading branch information
Surya-Narayan and OriolAbril committed Jun 12, 2023
1 parent 353508d commit f2d1f11
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 5 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
- InferenceData objects can now be appended to existing netCDF4 files and to specific groups within them ([2227](https://github.com/arviz-devs/arviz/pull/2227))

### Maintenance and fixes
- Replace deprecated np.product with np.prod ([2249](https://github.com/arviz-devs/arviz/pull/2249))
- Fix numba deprecation warning ([2246](https://github.com/arviz-devs/arviz/pull/2246))
- Fixes for creating numpy object array ([2233](https://github.com/arviz-devs/arviz/pull/2233) and [2239](https://github.com/arviz-devs/arviz/pull/2239))
- Adapt histograms generated by plot_dist to input dtype ([2247](https://github.com/arviz-devs/arviz/pull/2247))
Expand Down
4 changes: 2 additions & 2 deletions arviz/data/io_pystan.py
Original file line number Diff line number Diff line change
Expand Up @@ -669,8 +669,8 @@ def get_draws(fit, variables=None, ignore=None, warmup=False, dtypes=None):
par_idx = min(
(dim, i) for i, dim in enumerate(fit.sim["dims_oi"]) if (dim and np.prod(dim) != 0)
)[1]
offset = int(sum(map(np.product, fit.sim["dims_oi"][:par_idx])))
par_offset = int(np.product(fit.sim["dims_oi"][par_idx]))
offset = int(sum(map(np.prod, fit.sim["dims_oi"][:par_idx])))
par_offset = int(np.prod(fit.sim["dims_oi"][par_idx]))
par_keys = fit.sim["fnames_oi"][offset : offset + par_offset]
shift = len(par_keys)
for item in par_keys:
Expand Down
2 changes: 1 addition & 1 deletion arviz/stats/density_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ def _fixed_point(t, N, k_sq, a_sq):

for j in np.arange(l - 1, 2 - 1, -1):
c1 = (1 + 0.5 ** (j + 0.5)) / 3
c2 = np.product(np.arange(1.0, 2 * j + 1, 2, dtype=np.float64))
c2 = np.prod(np.arange(1.0, 2 * j + 1, 2, dtype=np.float64))
c2 /= (np.pi / 2) ** 0.5
t_j = np.power((c1 * (c2 / (N * f))), (2.0 / (3.0 + 2.0 * j)))
f = np.sum(k_sq**j * a_sq * np.exp(-k_sq * np.pi**2.0 * t_j))
Expand Down
4 changes: 2 additions & 2 deletions arviz/stats/stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -769,7 +769,7 @@ def loo(data, pointwise=None, var_name=None, reff=None, scale=None):
log_likelihood = log_likelihood.stack(__sample__=("chain", "draw"))
shape = log_likelihood.shape
n_samples = shape[-1]
n_data_points = np.product(shape[:-1])
n_data_points = np.prod(shape[:-1])
scale = rcParams["stats.ic_scale"] if scale is None else scale.lower()

if scale == "deviance":
Expand Down Expand Up @@ -1626,7 +1626,7 @@ def waic(data, pointwise=None, var_name=None, scale=None, dask_kwargs=None):
log_likelihood = log_likelihood.stack(__sample__=("chain", "draw"))
shape = log_likelihood.shape
n_samples = shape[-1]
n_data_points = np.product(shape[:-1])
n_data_points = np.prod(shape[:-1])

ufunc_kwargs = {"n_dims": 1, "ravel": False}
kwargs = {"input_core_dims": [["__sample__"]]}
Expand Down

0 comments on commit f2d1f11

Please sign in to comment.