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)
| Target | Type |
|---|---|
| getTrainingDistribution | calls |
Impact (Incoming)
| Source | Type |
|---|---|
| EvalMisclassified | uses |
| FIELD_DICTIONARY | uses |