# Cross-Model Conflict and Double-Counting Resolver

`D18-F09-A10` · Fundamental Analysis and Valuation → Integrated Equity Scoring · archetype `record-transform` · difficulty 4/5 · verification **verified**

Full page: https://docs.thefintechbuilder.com/fundamental-analysis-and-valuation/integrated-equity-scoring/cross-model-conflict-and-double-counting-resolver/
Agent skill: `npx skills add IslamBaraka90/Fintech-Algorithms-Library` — https://docs.thefintechbuilder.com/guides/agent-skill/

## 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

```ts
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

| Name | Type | Required | Notes |
| --- | --- | --- | --- |
| `data` | `{ group_cap: number; conflict_threshold: number; components: Array<{ name?: string; evidence_group: string; score: number; weight: number }> }` | yes | `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

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`:

```json
{
  "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

```ts
crossModelConflictAndDoubleCountingResolver(data)
```

### Returns

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

```json
{
  "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

`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.

## Verification and provenance

Tier: **verified** (via D).

The worked example below is the figure published in this algorithm's article, replayed and asserted by the test suite on every build. The arithmetic cannot drift without the build failing.

Both tiers guarantee the signature. Full explanation: https://docs.thefintechbuilder.com/guides/verification/

Generated from the docs.json payload shipped inside fintech-algorithms@0.13.0.
The signature and parameter list are checked against the compiled implementation at build time,
so a description that contradicts the code fails the build rather than reaching this file.

## Links

- Article (how it works, step by step): https://thefintechbuilder.com/fundamental-analysis-and-valuation/integrated-equity-scoring/cross-model-conflict-and-double-counting-resolver/
- Implementation source: https://github.com/IslamBaraka90/Fintech-Algorithms-Library/blob/main/src/fundamental-analysis-and-valuation/integrated-equity-scoring/cross-model-conflict-and-double-counting-resolver/impl.ts
- Package on npm: https://www.npmjs.com/package/fintech-algorithms
- Domain index for agents: https://docs.thefintechbuilder.com/fundamental-analysis-and-valuation/llms.txt
