MCPcopy Create free account
hub / github.com/QodeXcli/QodeX / median

Method median

src/llm/speculative.ts:150–155  ·  view source on GitHub ↗
(arr: number[])

Source from the content-addressed store, hash-verified

148 }
149
150 private median(arr: number[]): number | null {
151 if (arr.length < 3) return null; // need a few samples
152 const s = [...arr].sort((a, b) => a - b);
153 const mid = Math.floor(s.length / 2);
154 return s.length % 2 ? s[mid]! : (s[mid - 1]! + s[mid]!) / 2;
155 }
156
157 /**
158 * Returns a warning string if speculative decoding appears to be HURTING

Callers 2

checkRegressionMethod · 0.95
statsMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected