getBalancingNeeds function exported ✓ 100.0%

Last updated: 2026-02-24T21:07:57.551Z

Metrics

LOC: 16 Complexity: 3 Params: 2 Coverage: 100.0% (6/6 lines, 5x executed)

Signature

getBalancingNeeds( targetCount = 10, ): : Record<string, { current: number; needed: number }>

Summary

Returns the minimum number of extra samples needed per type to achieve a balanced dataset (all types have targetCount samples).

Source Code

export function getBalancingNeeds(
  targetCount = 10,
): Record<string, { current: number; needed: number }> {
  const dist = getTrainingDistribution();
  const result: Record<string, { current: number; needed: number }> = {};

  for (const entry of FIELD_DICTIONARY) {
    const current = dist[entry.type] || 0;
    result[entry.type] = {
      current,
      needed: Math.max(0, targetCount - current),
    };
  }

  return result;
}

Dependencies (Outgoing)

graph LR getBalancingNeeds["getBalancingNeeds"] getTrainingDistribution["getTrainingDistribution"] getBalancingNeeds -->|calls| getTrainingDistribution style getBalancingNeeds fill:#dbeafe,stroke:#2563eb,stroke-width:2px click getBalancingNeeds "260c9ebb87465dd1.html" click getTrainingDistribution "bcb2653a7652dea2.html"
TargetType
getTrainingDistribution calls

Impact (Incoming)

graph LR getBalancingNeeds["getBalancingNeeds"] EvalMisclassified["EvalMisclassified"] FIELD_DICTIONARY["FIELD_DICTIONARY"] EvalMisclassified -->|uses| getBalancingNeeds FIELD_DICTIONARY -->|uses| getBalancingNeeds style getBalancingNeeds fill:#dbeafe,stroke:#2563eb,stroke-width:2px click getBalancingNeeds "260c9ebb87465dd1.html" click EvalMisclassified "4e0d00ef54656ad2.html" click FIELD_DICTIONARY "9c3a352ea31b8001.html"
SourceType
EvalMisclassified uses
FIELD_DICTIONARY uses