hoops_ai.ml.context_layer.AggregationRule
- class hoops_ai.ml.context_layer.AggregationRule
Bases:
ABCBase class for context-aggregation rules.
A rule turns a list of
(value, score)pairs harvested from a single context key into oneContextPrediction. Subclasses must implementpredict();predict_with_context()is optional and defaults to ignoring the extra arguments and delegating topredict.Override
predict_with_context()when the rule wants to consume the query’s own attributes (query_context) or per-hit metadata (hits).NumericWeightedRuledoes this to run an internalRelevanceWeighterand/or an MLP without forcing the predictor to know about either.Override
bind()to receive a one-shot reference to theContextProviderat predictor construction. The default is a no-op so most rules can ignore it.- abstract predict(values, scores, key)
Predict a context value from neighbor evidence.
- Parameters:
- Returns:
ContextPrediction or None if insufficient evidence.
- Return type:
ContextPrediction | None