latent.stats.bayesian¶
Bayesian estimation for binary metrics.
Functions¶
beta_binomial_posterior¶
beta_binomial_posterior(successes: int, total: int, prior_alpha: float = 1.0, prior_beta: float = 1.0, confidence_level: float = 0.95) -> MetricResult
Beta-Binomial posterior with configurable prior.
Args: successes: Number of successes. total: Total trials. prior_alpha: Beta distribution alpha parameter (default 1 = uninformative). prior_beta: Beta distribution beta parameter (default 1 = uninformative). confidence_level: Credible interval level.
Returns: MetricResult with posterior mean and credible interval.
get_empirical_prior¶
Retrieve prior from most recent MLflow run.
Searches MLflow for the most recent run containing the specified metric and converts it to Beta distribution parameters.
Args: metric_name: Name of the metric to look up. experiment_name: Optional experiment name to search within.
Returns: Tuple of (alpha, beta) for Beta distribution prior. Returns (1.0, 1.0) if no prior run found.