deterministic_scoring

Use when: You already have section metrics, diffs, flags, and densities as dicts and want filing-level component scores without running the full pipeline — for custom pipelines or tests.

Start here

  • aggregate_deterministic_matrix() — blend inputs into component scores, coverage, and confidence

  • DeterministicAggregationResult — output dataclass with .components, .overall_disclosure_risk_score, etc.

For most applications, prefer score_filing_html() or score_deterministic() in pipeline — they assemble inputs automatically.

Example

from disclosure_alpha import aggregate_deterministic_matrix

result = aggregate_deterministic_matrix(
    section_metrics={"item_1a_risk_factors": {"negative_word_ratio": 0.02, ...}},
    section_diffs={"item_1a_risk_factors": 35.0},
    section_flags={"item_1a_risk_factors": {"investigation_flag": False}},
)
print(result.overall_disclosure_risk_score)

Full API

Deterministic filing-level scores from text metrics and diffs only.

class disclosure_alpha.deterministic_scoring.DeterministicComponentProvenance(score_name: 'str', value: 'float | None', inputs: 'dict[str, Any]'=<factory>, source: 'str' = 'deterministic')[source]

Bases: object

score_name : str
value : float | None
inputs : dict[str, Any]
source : str = 'deterministic'
to_dict() dict[str, Any][source]
class disclosure_alpha.deterministic_scoring.DeterministicAggregationResult(overall_disclosure_risk_score: float | None, score_coverage_ratio: float, confidence_score: float, missing_components: list[str] = <factory>, components: disclosure_alpha.scoring_types.ComponentScores = <factory>, aggregates: disclosure_alpha.scoring_types.AggregateScores = <factory>, provenance: 'list[DeterministicComponentProvenance]' = <factory>)[source]

Bases: MatrixAggregationResult

provenance : list[DeterministicComponentProvenance]
disclosure_alpha.deterministic_scoring.aggregate_deterministic_matrix(*, section_metrics: dict[str, dict[str, float]], section_diffs: dict[str, float | None], section_flags: dict[str, dict[str, bool]] | None = None, language_deltas: dict[str, dict[str, float]] | None = None, section_densities: dict[str, dict[str, float]] | None = None, config: ScoringConfig | None = None) DeterministicAggregationResult[source]
disclosure_alpha.deterministic_scoring.aggregate_deterministic_matrix_v2(*, section_metrics: dict[str, dict[str, float]], section_diffs: dict[str, float | None], section_flags: dict[str, dict[str, bool]] | None = None, language_deltas: dict[str, dict[str, float]] | None = None, section_densities: dict[str, dict[str, float]] | None = None, calibration_context: Any | None = None, section_diffs_v2: dict[str, float | None] | None = None, config: ScoringConfig | None = None) DeterministicAggregationResult[source]

Scoring v2: section-specific evidence, flag-only paths, calibrated tone ratios.