Skip to content

Commit

Permalink
Reformatting
Browse files Browse the repository at this point in the history
  • Loading branch information
Matteo NERI authored and Matteo NERI committed Jul 8, 2024
1 parent 6e06493 commit d415a32
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions hoi/utils/stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,13 +172,13 @@ def digitize(x, n_bins, axis=0, use_sklearn=False, **kwargs):
x_binned : array_like
Digitized array with the same shape as x
"""
bins_arr = (x.max(axis=axis)-x.min(axis=axis))/n_bins

# In case use_sklearn = False, all bins have the same size. In this case,
# in order to allow the histogram estimator, also the size of the bins is
# returned.
# In case use_sklearn = False, all bins have the same size. In this case,
# in order to allow the histogram estimator, also the size of the bins is
# returned.
bins_arr = (x.max(axis=axis) - x.min(axis=axis)) / n_bins
b_siz = jnp.prod(bins_arr)
if not use_sklearn:
return np.apply_along_axis(digitize_1d, axis, x, n_bins), jnp.prod(bins_arr)
return np.apply_along_axis(digitize_1d, axis, x, n_bins), b_siz
else:
kwargs["n_bins"] = n_bins
kwargs["encode"] = "ordinal"
Expand Down

0 comments on commit d415a32

Please sign in to comment.