scope_rl.utils.estimate_confidence_interval_by_empirical_bernstein#

scope_rl.utils.estimate_confidence_interval_by_empirical_bernstein(samples, alpha=0.05, **kwargs)[source]#

Estimate the confidence interval by the empirical bernstein inequality.

Note

The empirical bernstein inequality provides high-probability bounds of the expectation \(\mu := \mathbb{E}[X], X \sim p(X)\) as follows.

\[|\hat{\mu} - \mu| \leq \frac{7 X_{\max} \log(2 / \alpha)}{3 (n - 1)} + \sqrt{\frac{2 \hat{\mathbb{V}}(X) \log(2 / \alpha)}{n(n - 1)}},\]

which holds with probability \(1 - \alpha\) where \(n\) is the data size and \(\hat{\mathbb{V}}\) is the sample variance.

Parameters:
  • samples (array-like) – Samples.

  • alpha (float, default=0.05) – Significance level. The value should be within [0, 1).

Returns:

estimated_confidence_interval – Dictionary storing the estimated mean and upper-lower confidence bounds.

Return type:

dict