Skip to content

latent.flows.classification_flow

classification_flow — Classify a dataset and compute metrics (FR-3.4).

Functions

classification_flow

classification_flow(eval_data: pd.DataFrame, classifier: Any, labels: list[str] | None = None, gates: dict[str, float | GateSpec] | None = None, confidence_level: float = 0.95, n_resamples: int = 10000, seed: int | None = None) -> dict[str, Any]

Run a Classifier on a dataset and compute classification metrics.

The input DataFrame must have a 'ground_truth' column (convention).

Args: eval_data: DataFrame with columns matching classifier's prompt_template and a 'ground_truth' column. classifier: A Classifier[T] instance with evaluate(row) -> T. labels: Optional list of class labels. gates: Optional dict mapping metric name to threshold (float or GateSpec; bare floats gate on the point estimate). confidence_level: CI confidence level. n_resamples: Bootstrap resamples. seed: Random seed.

Returns: Dict with keys: predictions_data, metrics, all_passed.