skfolio.utils.stats.n_bins_knuth#

skfolio.utils.stats.n_bins_knuth(x)[source]#

Compute the optimal histogram bin size using Knuth’s rule [1].

Parameters:
xndarray of shape (n_observations,)

The input array.

Returns:
n_binsint

The optimal bin size.

References

[1]

“Optimal Data-Based Binning for Histograms”. Knuth.