/** SPC I-chart 표본 수 — 신뢰할 만한 관리한계의 통설 최소(20~25) 하한. 서버가 관장(표현 계층 아님). */ export declare const GAP_SAMPLES = 24; export interface GapPoint { t: number; p50: number; min: number; max: number; actual: number; error: number; inBand: boolean; naiveAbsError: number; modelAbsError: number; } /** 합산 결과 + **무엇을 못 넣었는지.** 알리지 않고 줄이지 않는다. */ export interface AggregateResult { points: GapPoint[]; /** 한 트윈이라도 재지 못해 통째로 뺀 vantage 수. */ droppedVantages: number; } /** * 공동배치(co-located) 트윈들의 점 배열을 공장 단위 한 시계열로 합산. * * ── 예전에 무엇이 어긋나 있었나 (2026-08-08) ───────────────────────────────── * "동일 부팅 → vantage 정렬" 을 **가정**하고 배열 인덱스끼리 더했다. 그 가정은 세 곳에서 깨졌다: * * ① 격자를 트윈마다 자기 저널의 첫·마지막 이벤트로 만들었다. 저널 구간이 다르면 같은 인덱스가 * 서로 다른 시각이다. **부팅이 같아도** 어긋난다. * ② 한 vantage 를 못 재면 `continue` 로 건너뛰고 밀어 담았다. 그 순간부터 인덱스가 한 칸씩 밀린다. * ③ 길이를 `max` 로 잡아, 뒤쪽 인덱스는 남은 트윈만 더해졌다 — 공장 합계 곡선이 꼬리에서 * 아래로 꺾인다. 공장과 아무 상관 없는 이유로. * * 셋 다 오류를 내지 않았다. 그럴듯한 곡선이 나오고, 그 곡선으로 예측 정확도를 판정했다. * * ── 지금 ──────────────────────────────────────────────────────────────────── * 격자는 밖에서 하나를 만들어 모두에게 같은 것을 주고(`sharedGrid`), 못 잰 자리는 `null` 로 * 남긴다. 여기서는 **모든 트윈이 값을 가진 vantage 만** 더한다. 하나라도 비면 그 시각의 * 공장 총량은 알 수 없는 것이지, 그 트윈이 0 을 낸 것이 아니다. * * 뺀 개수는 돌려준다 — 화면이 "24점 중 18점" 이라고 말할 수 있어야 한다. */ export declare function aggregatePoints(per: (GapPoint | null)[][]): AggregateResult; /** 안정성 축 + 편향 축 판정(관리도). errors = 실제−예측 시계열. */ export declare function computeSpc(errors: number[]): any; /** * 집계 지표 — 정확도(1−WMAPE)·편향(MPE)·예측구간 적중·FVA(예측 가치). * * A percentage whose denominator is zero is **not measured**, and says so with `null` (2026-09-24). * When every actual in the window is 0 — the line stood still, or the metric was not observed — WMAPE * is undefined. It used to become 0, so the card read "100% accurate" beside "0 of 6 in band, mean * error −20". Likewise `fvaPct` when the naive error is 0: 0 read as "the forecast adds nothing". * The absolute measures (mean error, in-band count, fva) are real in that window and stay. The two * neighbours below already refuse on thin evidence (`computeSpc` · `learnedCalibration`). */ export declare function gapMetrics(pts: GapPoint[]): any; /** 학습(자기보정) 예상 — 평균 오차(편향)를 걷어냈을 때 기대되는 정확도·커버리지. accBefore/covBefore 는 원본 지표에서. */ export declare function learnedCalibration(pts: GapPoint[], metrics: any): any;