fintech-algorithms
Using a coding agent? Give it the skill: npx skills add IslamBaraka90/Fintech-Algorithms-Library What it does →

Cross-Model Conflict and Double-Counting Resolver

Install and import#

bash
npm install fintech-algorithms
ts
import { crossModelConflictAndDoubleCountingResolver } from "fintech-algorithms/fundamental-analysis-and-valuation/integrated-equity-scoring/cross-model-conflict-and-double-counting-resolver";

Signature#

crossModelConflictAndDoubleCountingResolver(data)

Groups scored components by the evidence they share, caps each group's weight so correlated evidence cannot be counted twice, and flags groups whose members disagree by more than the conflict threshold.

Parameters#

NameTypeNotes
data{ group_cap: number; conflict_threshold: number; components: Array<{ name?: string; evidence_group: string; score: number; weight: number }> }group_cap is the largest weight any one evidence group may carry and must be greater than 0 and at most 1. conflict_threshold is the within-group score range that marks a conflict and must be greater than 0 and at most 100. Each component needs a text evidence_group, a score between 0 and 100 and a positive weight; name falls back to component.

Returns#

{ state: string; method: string; raw_score: number; resolved_score: number; double_counting_adjustment: number; groups: Array<{ group: string; raw_weight: number; capped_weight: number; mean_score: number; range: number; conflict: boolean }>; conflict_groups: string[]; conflict_count: number; group_cap: number; conflict_threshold: number }

raw_score is the weighted mean over all components as supplied and resolved_score the weighted mean of group means under the capped weights, with double_counting_adjustment their difference. groups carries one row per evidence group sorted by name, conflict_groups and conflict_count the groups whose range reaches the threshold, and state is conflict-detected when any exists, otherwise resolved.

Errors#

  • When components is not a nonempty list, or a component lacks a text evidence_group — throws TypeError
  • When group_cap or conflict_threshold is not a finite number — throws TypeError
  • When group_cap is not in (0, 1], or conflict_threshold is not in (0, 100] — throws RangeError
  • When a component score is below 0 or above 100, or its weight is not positive — throws RangeError

Complexity: time O(n log n), space O(n).

Worked example#

executed Captured by running this function on the input its own test provides. Real output of real code — but not asserted against a published figure.

Input#

data
{
  "group_cap": 0.4,
  "conflict_threshold": 30,
  "components": [
    {
      "name": "altman_liquidity",
      "score": 82,
      "weight": 0.3,
      "evidence_group": "liquidity"
    },
    {
      "name": "current_ratio",
      "score": 76,
      "weight": 0.2,
      "evidence_group": "liquidity"
    },
    {
      "name": "piotroski_quality",
      "score": 70,
      "weight": 0.25,
      "evidence_group": "quality"
    }
  ]
}

Call#

crossModelConflictAndDoubleCountingResolver(data)

Returns#

object with 10 fields: state, method, raw_score, resolved_score, double_counting_adjustment, groups, conflict_groups, conflict_count, …

{
  "state": "resolved",
  "method": "evidence-group-cap-and-conflict-resolver",
  "raw_score": 69.45833333333333,
  "resolved_score": 69.64,
  "double_counting_adjustment": 0.18166666666667197,
  "groups": [
    {
      "group": "liquidity",
      "raw_weight": 0.5,
      "capped_weight": 0.4,
      "mean_score": 79.6,
      "range": 6,
      "conflict": false
    },
    {
      "group": "quality",
      "raw_weight": 0.5,
      "capped_weight": 0.4,
      "mean_score": 57.5,
      "range": 25,
      "conflict": false
    },
    {
      "group": "resilience",
      "raw_weight": 0.2,
      "capped_weight": 0.2,
      "mean_score": 74,
      "range": 0,
      "conflict": false
    }
  ],
  "conflict_groups": [],
  "conflict_count": 0,
  "group_cap": 0.4,
  "conflict_threshold": 30
}

Other exports#

This module also exports calculate, pointInTimeStockScoringInputAssembly, stockScoringPeerCohortResolver, fundamentalMetricDirectionAndPeerNormalization, modelApplicabilityAndVariantRouter, accountingFinancialHealthComposite, earningsQualityComposite, dividendSafetyScore, balanceSheetResilienceScore, distressModelEnsemble, overallExplainableStockScore, scoreConfidenceMissingDataPenaltyAndAbstention, marketWideStockScreeningAndRanking, stockScoreHistoryMigrationAndChangeAttribution. Every module additionally exports run as an alias of its primary function, and a meta object carrying its catalog id, domain, family, shape and article URL.

Diagrams#

Cross-Model Conflict and Double-Counting Resolver — evidence clock
Cross-Model Conflict and Double-Counting Resolver — model anatomy
Cross-Model Conflict and Double-Counting Resolver — system map
Cross-Model Conflict and Double-Counting Resolver — threshold and interpretation
Cross-Model Conflict and Double-Counting Resolver — variant boundaries

How it works#

This page states the contract — how to call it correctly. The article explains the concept: why it works, and where it breaks.

Read the article →

References#

The rest of the Integrated Equity Scoring family#