hoops_ai.ml.context_layer.ContextPrediction

class hoops_ai.ml.context_layer.ContextPrediction(value, confidence, evidence_count=0, alternatives=<factory>, status=None, reasons=<factory>, coverage=None, evidence=None, injected_context=None)

Bases: object

A single predicted context value with confidence.

Parameters:
value

The inferred value for the context key.

Type:

Any

confidence

Probability/confidence in [0.0, 1.0].

Type:

float

evidence_count

Number of hits that contributed to this prediction.

Type:

int

alternatives

Runner-up predictions sorted by confidence descending.

Type:

list[dict[str, Any]]

status

Optional decision label — one of ready_to_propose, needs_review, or insufficient_evidence. None when the caller has not requested status evaluation.

Type:

str | None

reasons

Optional human-readable reasons explaining the status (empty when status is ready_to_propose or None).

Type:

list[str]

coverage

Optional coverage diagnostics about the hit pool that produced this prediction. Keys include observed_hits, total_hits, observed_score_weight, missing_score_weight. Successful predictions from ContextPredictor.infer include coverage; insufficient sentinels include coverage when status/evidence output was requested.

Type:

dict[str, Any] | None

evidence

Optional per-hit contribution records (rank, score, value, source). Populated only when return_evidence=True is passed to ContextPredictor.infer.

Type:

list[dict[str, Any]] | None

injected_context

Optional snapshot of the query_context the ContextPredictor actually fed to the rule for this key. Populated for numeric keys when ContextPredictor.infer forwards earlier ready_to_propose categorical predictions (or the caller’s query_context) so downstream rules can re-rank neighbors. None when no context was injected.

Type:

dict[str, Any] | None

alternatives: list[dict[str, Any]]
confidence: float
coverage: dict[str, Any] | None = None
evidence: list[dict[str, Any]] | None = None
evidence_count: int = 0
injected_context: dict[str, Any] | None = None
reasons: list[str]
status: str | None = None
value: Any