ConfidenceEllipseSimplex#
- class mlquantify.confidence.ConfidenceEllipseSimplex(prev_estims, confidence_level=0.95)[source]#
Confidence ellipse for prevalence estimates in the simplex.
Defines a multivariate confidence region based on a chi-squared threshold:
\[\begin{split}CE_{\alpha}(\pi) = \begin{cases} 1 & \text{if} (\pi - \mu)^T \Sigma^{-1} (\pi - \mu) \le \chi^2_{n-1}(1-\alpha) \\ 0 & \text{otherwise} \end{cases}\end{split}\]- Parameters:
- prev_estimsarray-like of shape (m, n)
Bootstrap prevalence estimates.
- confidence_levelfloat, default=0.95
Confidence level.
- Attributes:
- mean_ndarray of shape (n,)
Mean prevalence estimate.
- precision_matrixndarray of shape (n, n)
Inverse covariance matrix of estimates.
- chi2_valfloat
Chi-squared cutoff threshold defining the ellipse.
References
- [1] Moreo, A., & Salvati, N. (2025).
An Efficient Method for Deriving Confidence Intervals in Aggregative Quantification. Section 3.3, Equation (2).
Examples
>>> X = np.random.dirichlet(np.ones(3), size=200) >>> ce = ConfidenceEllipseSimplex(X, confidence_level=0.95) >>> ce.get_point_estimate().round(3) array([0.33, 0.34, 0.33]) >>> ce.contains(np.array([0.4, 0.3, 0.3])) True