Confidence Intervals¶
evaluatio.inference.ci
¶
Bootstrap-based confidence interval estimation utilities.
This module provides functionality to estimate empirical confidence intervals using bootstrap resampling. It also defines a lightweight container for returning confidence interval results.
The implementation relies on optimized native bindings for performance.
ConfidenceInterval
dataclass
¶
Container for confidence interval results.
Attributes:
| Name | Type | Description |
|---|---|---|
mean |
float
|
The mean of the input sample. |
lower |
float
|
The lower bound of the confidence interval. |
upper |
float
|
The upper bound of the confidence interval. |
bootstrap_confidence_interval ¶
Estimate a confidence interval using bootstrap resampling
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
Iterable[float]
|
Input sample values. |
required |
iterations
|
int
|
Number of bootstrap resampling iterations. |
required |
alpha
|
float
|
Significance level for the confidence interval. For example,
|
required |
Returns:
| Type | Description |
|---|---|
ConfidenceInterval
|
Results dataclass. Fields: |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
Notes
- The confidence interval is computed empirically via bootstrap sampling.
- The returned mean is computed from the original sample, not the bootstrap distribution.
Examples:
error_rate_ci ¶
Estimate a confidence interval using bootstrap directly on error counts
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
counts
|
Iterable[int]
|
The error counts |
required |
exposure
|
Iterable[int]
|
A list of lengths to normalise by |
required |
iterations
|
int
|
Number of bootstrap resampling iterations. |
required |
alpha
|
float
|
Significance level for the confidence interval. For example,
|
required |
Returns:
| Type | Description |
|---|---|
ConfidenceInterval
|
Results dataclass. Fields: |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
Notes
- The confidence interval is computed empirically via bootstrap sampling of the counts and exposure.
- The returned mean is computed from the original sample, not the bootstrap distribution.
See Also
word_error_rate_ci,character_error_rate_ci, anduniversal_error_rate_ciare all wrappers around this function.
Examples: