Skip to content

[EPIC] Stabilize mathematical return contracts #56

Description

@Cubits11

Purpose

Make core mathematical APIs predictable, typed, and impossible to misunderstand.

Problems

  • frechet_upper may return either a scalar float or a tuple containing diagnostics.
  • CC coefficient functions return loose dictionaries with mixed values.
  • comp.upper() widens typed Literals to plain str.
  • Denominator-zero behavior differs across modules.
  • ROC-style J and two-world J are both valid but not clearly separated everywhere.

Target

  • Scalar functions return scalars.
  • Diagnostic functions return typed result objects.
  • Composition types are normalized centrally.
  • CC undefined behavior is explicit.
  • ROC J and two-world J are named separately.

Candidate Fixes

  • Add Comp, CompInput, and normalize_comp.
  • Split frechet_upper from diagnostic/uncertainty variants.
  • Add ComposabilityCoefficients dataclass or TypedDict.
  • Add explicit roc_youden_j and two_world_j.
  • Decide legacy behavior for metrics.cc_max.

Definition of Done

  • Composition normalization helper exists
  • frechet_upper(...) -> float is stable
  • Diagnostic return path is explicit
  • CC denominator policy is tested
  • ROC J vs two-world J semantics are documented and tested

Child Issues

  • Normalize composition literals
  • Split FH scalar and diagnostic return contracts
  • Type composability coefficient result
  • Add J semantics tests
  • Add CC denominator degeneracy tests

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions