MATIH Platform is in active MVP development. Documentation reflects current implementation status.
14. Context Graph & Ontology
Analytics & Ranking
Decision Ranking

Decision Ranking

The DecisionRankingService provides multi-factor ranking of past decisions for precedent search. It combines semantic similarity, temporal relevance, outcome confidence, and contextual matching to surface the most useful historical precedents.


Overview

When agents or users face a decision, the ranking service retrieves and ranks similar past decisions based on multiple factors. This enables data-driven decision-making by learning from historical outcomes.

Source: data-plane/ai-service/src/context_graph/services/decision_ranking_service.py


Ranking Factors

FactorDefault WeightDescription
SEMANTIC_SIMILARITY0.35Cosine similarity between decision rationale embeddings
TEMPORAL_RELEVANCE0.20Exponential decay based on decision age
OUTCOME_CONFIDENCE0.25Success rate of the historical decision
CONTEXT_MATCH0.10Overlap between current and historical context
ENTITY_TYPE_MATCH0.05Whether subject entity types are the same
DOMAIN_MATCH0.05Whether decisions are in the same domain

Configuration

from context_graph.services.decision_ranking_service import RankingConfig
 
config = RankingConfig(
    semantic_weight=0.35,
    temporal_weight=0.20,
    outcome_weight=0.25,
    context_weight=0.10,
    entity_type_weight=0.05,
    domain_weight=0.05,
    temporal_half_life_days=90,
    min_combined_score=0.3,
)

Outcome Statuses

The outcome of past decisions directly impacts their ranking score:

StatusScore MultiplierDescription
SUCCESSFUL1.0Full outcome confidence
PARTIALLY_SUCCESSFUL0.6Moderate confidence
FAILED0.2Low confidence (still returned for learning)
PENDING0.4Outcome not yet known
UNKNOWN0.3Outcome was never recorded

Scoring Formula

The final ranking score is computed as:

score = (semantic_weight * semantic_similarity)
      + (temporal_weight * temporal_decay)
      + (outcome_weight * outcome_confidence)
      + (context_weight * context_overlap)
      + (entity_type_weight * type_match)
      + (domain_weight * domain_match)

Where temporal_decay = exp(-age_days / half_life_days).


API Usage

ranked_decisions = await ranking_service.rank_precedents(
    query_embedding=query_vector,
    tenant_id="acme",
    decision_type="model_deployment",
    top_k=10,
    config=config,
)

Pattern Inference

Beyond ranking individual decisions, the service can infer patterns from clusters of similar decisions:

  • Common decision sequences (e.g., "approve data access" often follows "data quality review")
  • Decision outcome correlations (e.g., decisions with peer review have higher success rates)
  • Temporal patterns (e.g., schema changes are more successful when done mid-week)

Integration Points

ComponentIntegration
Hybrid StoreProvides embedding vectors for semantic similarity
BiTemporal StoreStores and retrieves decision history
Pattern MiningFeeds decision patterns into the mining pipeline
Feedback ScoringOutcome signals update decision confidence scores