<a id="skfolio-utils-stats-n-bins-freedman"></a>

# skfolio.utils.stats.n_bins_freedman

<a id="skfolio.utils.stats.n_bins_freedman"></a>

### skfolio.utils.stats.n_bins_freedman(x)

Compute the optimal histogram bin size using the Freedman-Diaconis rule [[1]](#r8d5b646da1d1-1).

* **Parameters:**
  **x** *ndarray of shape (n_observations,)*
  : The input array.
* **Returns:**
  **n_bins** *int*
  : The optimal bin size.

### References

* <a id='r8d5b646da1d1-1'>**[1]**</a> “On the histogram as a density estimator: L2 theory”. Freedman & Diaconis (1981).

