Uniform Bands

uniformbands is a simple Python package providing a function that computes uniform confidence bands from initial high probability lower and upper bounds using either the uniform or student method with theoretical covering guarantees.

Features

  • Multiple Methods: Choose between “uniform” and “student” bands depending on the desired statistical properties.

  • Input Flexibility: Works with 2D or higher-dimensional arrays, supporting potentially different lower and upper bounds.

Installation

You can install the package via pip:

pip install uniformbands

API Reference

get_bands(F_lo, F_hi=None, alpha=0.05, *, eps=1e-08, method='uniform', min_val=0.0, max_val=1.0)[source]

Gets the uniform bands according the specified method.

Parameters:
  • F_lo (np.ndarray) – The lower high probability bounds.

  • F_hi (np.ndarray) – The upper high probability bounds. Defaults to None.

  • alpha (float, optional) – The level of supplementary risk. Defaults to 0.05.

  • eps (float, optional) – The regularization parameter to ensure a well defined division. Defaults to 1e-8.

  • method (str, optional) – Either “uniform” or “student”, the method used to compute uniform bands. Defaults to “uniform”.

  • min_val (float, optional) – The minimum accepted values of the functions. Defaults to 0.0.

  • max_val (float, optional) – The maximum accepted values of the functions. Defaults to 1.0.

Raises:
  • ValueError – If the shapes of F_lo and F_hi don’t match.

  • ValueError – If F_lo and F_hi do not have at least 2 dimensions.

  • ValueError – If alpha is not in (0, 1).

  • ValueError – If eps is not strictly positive for ‘student’ method.

  • ValueError – If the method is not ‘uniform’ nor ‘student’.

Returns:

The computed bands with keys “lower” and “upper”.

Return type:

dict[str, np.ndarray]