pyrfu.pyrf.optimize_nbins_1d module#

pyrfu.pyrf.optimize_nbins_1d.optimize_nbins_1d(x, n_min: int = 1, n_max: int = 100)[source]#

Estimates the number of bins for 1d histogram that minimizes the risk function in [1] , obtained by direct decomposition of the MISE following the method described in [2] .

Parameters:
  • x (xarray.DataArray) – Input time series

  • n_min (int, Optional) – Minimum number of bins. Default is 1.

  • n_max (int, Optional) – Maximum number of bins. Default is 100.

Returns:

opt_n_x – Number of bins that minimizes the cost function.

Return type:

int

References

[1]

Rudemo, M. (1982) Empirical Choice of Histograms and Kernel Density Estimators. Scandinavian Journal of Statistics, 9, 65-78.

[2]

Shimazaki H. and Shinomoto S., A method for selecting the bin size of a time histogram Neural Computation (2007) Vol. 19(6), 1503-1527