accuracy-claim-kit 0.0.0-stage → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +38 -0
- package/LICENSE +21 -0
- package/METHOD.md +99 -0
- package/README.md +478 -2
- package/dist/agreement.d.ts +62 -0
- package/dist/agreement.js +141 -0
- package/dist/agreement.js.map +1 -0
- package/dist/assess.d.ts +36 -0
- package/dist/assess.js +954 -0
- package/dist/assess.js.map +1 -0
- package/dist/census.d.ts +44 -0
- package/dist/census.js +95 -0
- package/dist/census.js.map +1 -0
- package/dist/dates.d.ts +2 -0
- package/dist/dates.js +23 -0
- package/dist/dates.js.map +1 -0
- package/dist/display.d.ts +56 -0
- package/dist/display.js +341 -0
- package/dist/display.js.map +1 -0
- package/dist/exact.d.ts +48 -0
- package/dist/exact.js +102 -0
- package/dist/exact.js.map +1 -0
- package/dist/format.d.ts +29 -0
- package/dist/format.js +120 -0
- package/dist/format.js.map +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +5 -0
- package/dist/index.js.map +1 -0
- package/dist/normal.d.ts +12 -0
- package/dist/normal.js +100 -0
- package/dist/normal.js.map +1 -0
- package/dist/text.d.ts +58 -0
- package/dist/text.js +202 -0
- package/dist/text.js.map +1 -0
- package/dist/types.d.ts +186 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/dist/validate.d.ts +44 -0
- package/dist/validate.js +156 -0
- package/dist/validate.js.map +1 -0
- package/dist/wilson.d.ts +41 -0
- package/dist/wilson.js +86 -0
- package/dist/wilson.js.map +1 -0
- package/package.json +76 -4
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"assess.js","sourceRoot":"","sources":["../src/assess.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AACzD,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;AACtC,OAAO,EAAE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QAAQ,CAAC,OAAO,OAAO,CAAC,CAAC,CAAC,IAAI,EAAE,QAAQ,CAAC,EAAE;QACpF,OAAO,MAAM,CAAC,CAAC,CAAC,EAAE;QAClB,SAAS;QACT,WAAW,CAAC,QAAQ,CAAC,IAAI,eAAe;KACzC,CAAA;IACD,IAAI,cAAc,KAAK,SAAS;QAAE,KAAK,CAAC,IAAI,CAAC,aAAa,cAAwB,EAAE,CAAC,CAAA;IACrF,IAAI,SAAS,KAAK,SAAS,IAAI,SAAS,CAAC,KAAK,KAAK,IAAI,EAAE,CAAC;QACxD,KAAK,CAAC,IAAI,CAAC,GAAG,eAAe,CAAC,SAAS,CAAC,SAAS,CAAC,IAAI,UAAU,CAAC,SAAS,CAAC,KAAK,EAAE,CAAC,EAAE,MAAM,CAAC,EAAE,CAAC,CAAA;IACjG,CAAC;IACD,OAAO;QACL,OAAO;QACP,OAAO;QACP,WAAW;QACX,MAAM;QACN,OAAO;QACP,aAAa,EAAE,QAAQ;QACvB,CAAC;QACD,KAAK,EAAE,iBAAiB;QACxB,aAAa;QACb,MAAM;QACN,QAAQ;QACR,iBAAiB;QACjB,kBAAkB,EAAE,GAAG,QAAQ,KAAK,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,MAAM,GAAG,aAAa,EAAE;KACnF,CAAA;AACH,CAAC","sourcesContent":["import type { AgreementStatistic, UndefinedAgreementReason } from './agreement.js'\nimport { countDecimals, matchesValue } from './census.js'\nimport { dayNumber } from './dates.js'\nimport { parseDisplayFigure, textFiguresDiffering } from './display.js'\nimport { beyondNoise, snapAbsolute, VALUE_NOISE } from './exact.js'\nimport type { DisplayFigure } from './display.js'\nimport { confidenceLabel, decimalCut, maxDisplayDecimals, pctCeil, pctFloor, pctNearest } from './format.js'\nimport type {\n AccuracyAssessment,\n AccuracyClaimInput,\n AccuracyVerdict,\n AssessOptions,\n ClaimMetric,\n GateChecks,\n UnsupportedMetric,\n LabelSource,\n ReasonCode,\n SamplingMethod,\n} from './types.js'\nimport {\n clip,\n isRecord,\n MAX_COUNT,\n readCount,\n readFiniteInRange,\n readLength,\n assertKnownKeys,\n assertPlainObject,\n readOpenUnit,\n requireRecord,\n} from './validate.js'\nimport { assertPlainText, foldText, MAX_LABEL_LENGTH, MAX_TEXT_LENGTH, mentionsName, readName, shownText } from './text.js'\nimport { DEFAULT_CONFIDENCE, wilsonWithZ, zForConfidence, zForTail } from './wilson.js'\n\n/** Lowest confidence level `assessAccuracyClaim` accepts. `wilsonInterval` takes any level strictly between 0 and 1. */\nconst MIN_ASSESS_CONFIDENCE = 0.5\n\n/** Smallest sample that gets a verdict unless options.minN says otherwise. */\nexport const DEFAULT_MIN_N = 30\n\n/**\n * Absolute tolerance, as a proportion, when a claim is compared with an\n * interval limit. A claim within this distance of a limit counts as being at\n * the limit, on the claimant's side. It exists only to absorb binary\n * floating-point noise (a claim of exactly 0.98 against a limit that\n * computes to 0.98000000000000001). It is far below the width of any\n * interval met in practice; it can only matter for samples above about 4e12\n * items with a rate within about 1e-12 of 0 or 1, where the interval itself\n * is narrower than the tolerance. A claim of exactly 0 or 1 is absolute and\n * never uses it.\n */\nexport const COMPARISON_TOLERANCE = 1e-12\n\nconst SOURCES: readonly LabelSource[] = ['human', 'automated', 'by-construction', 'model', 'mixed', 'unknown']\nconst SAMPLINGS: readonly SamplingMethod[] = ['random', 'stratified', 'ranked', 'convenience', 'unknown', 'complete', 'held-out-split', 'cross-validation']\nconst METRICS: readonly ClaimMetric[] = [\n 'accuracy',\n 'error-rate',\n 'precision',\n 'recall',\n 'false-positive-rate',\n 'false-negative-rate',\n 'specificity',\n 'npv',\n 'sensitivity',\n 'ppa',\n 'ppv',\n 'npa',\n 'opa',\n]\n/** Metrics the kit knows it cannot judge: they get a refusal, not a throw. */\nconst UNSUPPORTED_METRICS: readonly UnsupportedMetric[] = [\n 'f1', 'auc', 'roc-auc', 'wer', 'cer', 'bleu', 'rouge', 'map', 'composite', 'other',\n]\nconst HIGHER_IS_BETTER: readonly ClaimMetric[] = ['accuracy', 'precision', 'recall', 'specificity', 'npv', 'sensitivity', 'ppa', 'ppv', 'npa', 'opa']\nconst METRIC_PHRASE: Record<ClaimMetric, string> = {\n accuracy: 'accurate',\n 'error-rate': 'error rate',\n precision: 'precision',\n recall: 'recall',\n 'false-positive-rate': 'false-positive rate',\n 'false-negative-rate': 'false-negative rate',\n specificity: 'specificity',\n npv: 'negative predictive value',\n sensitivity: 'sensitivity',\n ppa: 'positive percent agreement',\n ppv: 'positive predictive value',\n npa: 'negative percent agreement',\n opa: 'overall percent agreement',\n}\n/** What a bare value (no display) is read at; nothing was printed, so the text must not say so. */\nconst VALUE_PRECISION = 'the precision of the value (a whole percent at the coarsest)'\nconst SUPPORTED_LIST = 'accuracy, error-rate, precision, recall, false-positive-rate, false-negative-rate, specificity, npv and the diagnostic names sensitivity, ppa, ppv, npa and opa'\n// The keys each caller-supplied object may carry. Anything else is a typo that\n// would silently switch a check off, so it throws.\nconst OPTION_KEYS = ['confidence', 'minN', 'minAgreement', 'maxAgeDays', 'now', 'strictPrecision', 'conservative', 'requireScope'] as const\nconst INPUT_KEYS = ['claim', 'sample', 'provenance', 'sampling', 'strata', 'retractions', 'benchmark', 'population', 'evaluatedAt'] as const\nconst CLAIM_KEYS = ['metric', 'value', 'display', 'text'] as const\nconst SAMPLE_KEYS = ['n', 'correct', 'errors'] as const\nconst STRATUM_KEYS = ['name', 'n', 'correct', 'errors'] as const\nconst PROVENANCE_KEYS = ['source', 'raters', 'agreement'] as const\nconst AGREEMENT_KEYS = ['statistic', 'status', 'value', 'n', 'agreements', 'categories', 'reason'] as const\nconst RETRACTION_KEYS = ['count', 'includedInSample'] as const\nconst BENCHMARK_KEYS = ['name'] as const\nconst POPULATION_KEYS = ['claimed', 'evaluated'] as const\nconst STATISTICS: readonly AgreementStatistic[] = ['percent-agreement', 'cohen-kappa', 'gwet-ac1']\nconst UNDEFINED_REASONS: readonly UndefinedAgreementReason[] = ['no-pairs', 'expected-agreement-is-1', 'single-category']\nconst STATISTIC_LABEL: Record<AgreementStatistic, string> = {\n 'percent-agreement': 'percent agreement',\n 'cohen-kappa': 'Cohen kappa',\n 'gwet-ac1': 'Gwet AC1',\n}\n\nfunction readEnum<T extends string>(value: unknown, allowed: readonly T[], name: string): T {\n if (typeof value !== 'string') throw new TypeError(`${name} must be a string`)\n const found = allowed.find((candidate) => candidate === value)\n if (found === undefined) {\n throw new RangeError(`${name} must be one of ${allowed.join(', ')}; got \"${clip(value)}\"`)\n }\n return found\n}\n\n/**\n * The metric: judged (exact, lower-case name), known-unsupported (refused\n * later; case does not matter, since such a name can only be refused), or\n * unknown (thrown). A judged name in the wrong case is a typo that throws, with\n * the name the caller probably meant.\n */\nfunction readMetric(raw: unknown): { metric: ClaimMetric | UnsupportedMetric; judged: boolean } {\n if (typeof raw !== 'string') throw new TypeError('claim.metric must be a string')\n const supported = METRICS.find((m) => m === raw)\n if (supported !== undefined) return { metric: supported, judged: true }\n const lower = raw.toLowerCase()\n const unsupported = UNSUPPORTED_METRICS.find((m) => m === lower)\n if (unsupported !== undefined) return { metric: unsupported, judged: false }\n const meant = METRICS.find((m) => m === lower)\n const hint = meant === undefined ? '' : `; did you mean \"${meant}\"?`\n throw new RangeError(\n `claim.metric must be one of ${METRICS.join(', ')}, or one of ${UNSUPPORTED_METRICS.join(', ')} (which the kit knows and refuses, in any case); got \"${clip(raw)}\"${hint}`,\n )\n}\n\ninterface Counts {\n n: number\n correct: number\n}\n\n/** Reads {n, correct?, errors?} for the sample; null when no counts were disclosed at all. */\nfunction readSampleCounts(raw: unknown): Counts | null {\n if (raw === undefined) return null\n const rec = requireRecord(raw, 'sample')\n assertKnownKeys(rec, SAMPLE_KEYS, 'sample')\n const nRaw: unknown = rec.n\n const correctRaw: unknown = rec.correct\n const errorsRaw: unknown = rec.errors\n if (nRaw === undefined && correctRaw === undefined && errorsRaw === undefined) return null\n return readCounts({ n: nRaw, correct: correctRaw, errors: errorsRaw }, 'sample')\n}\n\n/** Reads {n, correct?, errors?}; each property once. */\nfunction readCounts(raw: unknown, name: string): Counts {\n const rec = requireRecord(raw, name)\n const nRaw: unknown = rec.n\n const correctRaw: unknown = rec.correct\n const errorsRaw: unknown = rec.errors\n const n = readCount(nRaw, `${name}.n`, 1)\n if (correctRaw === undefined && errorsRaw === undefined) {\n throw new TypeError(`${name} needs correct or errors`)\n }\n const correct = correctRaw === undefined ? undefined : readCount(correctRaw, `${name}.correct`, 0)\n const errors = errorsRaw === undefined ? undefined : readCount(errorsRaw, `${name}.errors`, 0)\n if (correct !== undefined && correct > n) {\n throw new RangeError(`${name}.correct (${String(correct)}) is larger than n (${String(n)})`)\n }\n if (errors !== undefined && errors > n) {\n throw new RangeError(`${name}.errors (${String(errors)}) is larger than n (${String(n)})`)\n }\n if (correct !== undefined && errors !== undefined && correct + errors !== n) {\n throw new RangeError(`${name}.correct + ${name}.errors must equal n`)\n }\n return { n, correct: correct !== undefined ? correct : n - (errors as number) }\n}\n\ninterface Agreement {\n statistic: AgreementStatistic\n value: number | null\n /** Items the statistic was computed on; null for a hand-written {statistic, value}, which is trusted. */\n n: number | null\n}\n\nfunction readAgreement(raw: unknown): Agreement {\n const rec = requireRecord(raw, 'provenance.agreement')\n assertKnownKeys(rec, AGREEMENT_KEYS, 'provenance.agreement')\n const statisticRaw: unknown = rec.statistic\n const statusRaw: unknown = rec.status\n const valueRaw: unknown = rec.value\n const nRaw: unknown = rec.n\n const agreementsRaw: unknown = rec.agreements\n const categoriesRaw: unknown = rec.categories\n const reasonRaw: unknown = rec.reason\n const statistic = readEnum(statisticRaw, STATISTICS, 'provenance.agreement.statistic')\n if (statusRaw !== undefined && statusRaw !== 'defined' && statusRaw !== 'undefined') {\n throw new RangeError('provenance.agreement.status must be \"defined\" or \"undefined\"')\n }\n const n = nRaw === undefined ? null : readCount(nRaw, 'provenance.agreement.n', 0)\n // The keys a kit result carries are allowed so it can be passed straight in; they\n // are not used, but nonsense in them means the object is not what it claims to be.\n const agreements = agreementsRaw === undefined ? null : readCount(agreementsRaw, 'provenance.agreement.agreements', 0)\n if (agreements !== null && n !== null && agreements > n) {\n throw new RangeError(`provenance.agreement.agreements (${String(agreements)}) is larger than provenance.agreement.n (${String(n)})`)\n }\n if (categoriesRaw !== undefined) readCount(categoriesRaw, 'provenance.agreement.categories', 0)\n if (reasonRaw !== undefined) readEnum(reasonRaw, UNDEFINED_REASONS, 'provenance.agreement.reason')\n if (statusRaw === 'undefined') {\n // A statistic that has no value must say so with null; NaN, 0 or text in\n // its place is malformed input, not \"cannot tell\".\n if (valueRaw !== null) {\n const message = 'provenance.agreement.value must be null when status is \"undefined\"'\n throw typeof valueRaw === 'number' ? new RangeError(message) : new TypeError(message)\n }\n return { statistic, value: null, n }\n }\n return { statistic, value: readFiniteInRange(valueRaw, 'provenance.agreement.value', -1, 1), n }\n}\n\ninterface Stratum {\n name: string\n n: number\n correct: number\n}\n\nfunction readStrata(raw: unknown): Stratum[] {\n if (!Array.isArray(raw)) throw new TypeError('strata must be an array')\n const length = readLength((raw as unknown[]).length, 'strata')\n if (length === 0) throw new RangeError('strata must not be empty; leave it out if there are none')\n const out: Stratum[] = []\n const names = new Set<string>()\n for (let i = 0; i < length; i++) {\n const entry: unknown = (raw as unknown[])[i]\n const rec = requireRecord(entry, `strata[${i}]`)\n assertKnownKeys(rec, STRATUM_KEYS, `strata[${i}]`)\n const nameRaw: unknown = rec.name\n if (typeof nameRaw !== 'string') throw new TypeError(`strata[${i}].name must be a string`)\n if (nameRaw === '') throw new RangeError(`strata[${i}].name must not be empty`)\n if (nameRaw.length > MAX_LABEL_LENGTH) {\n throw new RangeError(`strata[${i}].name must be at most ${String(MAX_LABEL_LENGTH)} characters`)\n }\n const name = shownText(nameRaw, `strata[${i}].name`)\n if (name === '') throw new RangeError(`strata[${i}].name must not be blank`)\n if (names.has(name)) throw new RangeError(`strata[${i}].name \"${clip(name)}\" is a duplicate`)\n names.add(name)\n const counts = readCounts(rec, `strata[${i}]`)\n out.push({ name, ...counts })\n }\n return out\n}\n\nconst REFUSAL_PHRASE: Record<string, string> = {\n 'metric-not-supported': 'this kit cannot judge that kind of metric',\n 'n-undisclosed': 'the number of items checked was not disclosed',\n 'no-human-labels': 'the labels were not checked by people',\n 'unknown-label-source': 'nobody has said where the labels came from',\n 'mixed-label-source': 'only some labels came from people and the counts are not split',\n 'ranked-sample': 'the sample was picked by rank, not at random',\n 'convenience-sample': 'the sample was whatever was easy to collect',\n 'unknown-sampling': 'nobody has said how the sample was picked',\n 'sample-too-small': 'the sample is too small',\n 'merged-strata-differ': 'groups with clearly different rates were merged into one number',\n 'retractions-not-included': 'known retractions are not in the counts',\n 'agreement-missing': 'no agreement statistic was supplied for the required agreement check',\n 'agreement-undefined': 'the agreement statistic could not be computed',\n 'agreement-below-minimum': 'the raters agreed less than the required minimum',\n 'agreement-sample-too-small': 'the agreement statistic was computed on too few items',\n 'stratified-without-strata': 'the sample is stratified but the strata were not supplied, so the pooled counts cannot be read as the population rate',\n 'benchmark-unnamed': 'a complete-set or held-out-split claim needs the name of the fixed set',\n 'claim-not-scoped-to-benchmark': 'the claim wording does not name the benchmark, so a benchmark score is standing in for a general claim',\n 'evaluation-date-missing': 'a maximum age was set but the evaluation date was not supplied',\n 'evaluation-stale': 'the evaluation is older than the allowed age',\n 'scope-mismatch': 'the claim covers a different population than the one evaluated',\n 'scope-undeclared': 'the claimed and evaluated populations were not declared',\n}\n\nconst LABEL_WORD: Record<'human' | 'automated' | 'by-construction', string> = {\n human: 'human labels',\n automated: 'automated labels',\n 'by-construction': 'labels fixed by construction',\n}\n\n/** What the interval in a statement does and does not cover, said in the statement itself. */\nconst SAMPLING_ERROR_ONLY = 'the interval covers sampling error only'\nconst SAMPLING_ERROR_ONLY_CV = 'the interval covers sampling error only and is optimistic because cross-validation folds share data'\n\nconst SAMPLE_WORD: Partial<Record<SamplingMethod, string>> = {\n stratified: 'stratified sample, unweighted pooled',\n 'cross-validation': 'cross-validation estimate',\n}\n\n/** \"1 decimal place\", \"2 decimal places\"; whole percents have none. */\nfunction placesWord(decimals: number): string {\n return decimals === 1 ? '1 decimal place' : `${String(decimals)} decimal places`\n}\n/** What a precision limit allows: \"whole percents only\", \"at most 1 decimal place\". */\nfunction supportsWord(decimals: number): string {\n return decimals === 0 ? 'whole percents only' : `at most ${placesWord(decimals)}`\n}\n/**\n * The observed rate as a figure to print that the same assessment would pass as\n * `matches-observed-rate`, or null when none exists. With `maxDecimals` null\n * (the default, where excess precision is only noted) the figure is printed to\n * three decimals, or to as many more as it takes to keep it off 0% and 100%\n * (those are absolute claims a sample cannot show); with a limit (strictPrecision)\n * it must fit that many decimals, and an exact tie may be reached from either\n * neighbor. A candidate is judged by the display parser itself, so it cannot\n * drift from what the assessment accepts.\n */\nfunction observedAdvice(point: number, successes: number, n: number, maxDecimals: number | null, higherIsBetter: boolean): string | null {\n if (point === 0 || point === 1) return null\n const first = maxDecimals === null ? 3 : maxDecimals\n const last = maxDecimals === null ? 12 : maxDecimals\n for (let d = first; d <= last; d++) {\n for (const printed of [pctNearest(point, d), pctFloor(point, d), pctCeil(point, d)]) {\n const figure = parseDisplayFigure(printed, higherIsBetter)\n if (figure.info.figure !== 0 && figure.info.figure !== 1 && figure.matchesObserved(successes, n)) return printed\n }\n }\n return null\n}\n\n/** The statement's advice on how to print the figure. */\nfunction printAdvice(decimals: number): string {\n return decimals === 0 ? '; print it as a whole percent' : `; print it to at most ${placesWord(decimals)}`\n}\n\n/**\n * The informational note for a figure in `claim.text` that is not the figure\n * judged (`text-figure-differs`), or null. The text is only scanned: a verdict\n * is never changed by it.\n */\nfunction textFigureNote(text: string | undefined, claimed: number, assessed: number, higherIsBetter: boolean): string | null {\n if (text === undefined) return null\n const differing = textFiguresDiffering(text, claimed, assessed, higherIsBetter)\n if (differing.length === 0) return null\n const shown = differing.slice(0, 3).map((figure) => `\"${clip(figure, 40)}\"`).join(', ')\n const more = differing.length > 3 ? ` and ${String(differing.length - 3)} more` : ''\n return `claim.text says ${shown}${more}, which is not the figure judged (${pctNearest(assessed, 3)}). The verdict judges value and display, never the wording, so make the text say what was judged.`\n}\n\n/**\n * Does this accuracy or error-rate claim have the evidence to carry it?\n *\n * Pure statistics on the counts you pass in. It never judges whether the\n * labels are right and cannot see how the sample was really drawn; it takes\n * your `provenance` and `sampling` declarations at their word and refuses\n * when they do not support a figure.\n *\n * Verdicts:\n * - refused: a precondition failed. This means \"cannot tell\", not \"false\".\n * - contradicted: the claim is more favorable than the interval's best end.\n * - overstated: inside the interval but more favorable than the observed\n * rate (or, with options.conservative, than the conservative end), or\n * printed with finer precision than the interval allows.\n * - supported: no more favorable than the conservative end, or an honest\n * report of the observed rate to its printed precision.\n *\n * Malformed input throws (TypeError for a wrong type, RangeError for a wrong\n * value); it never returns a verdict. Every input property is read once.\n */\nexport function assessAccuracyClaim(\n input: AccuracyClaimInput,\n options?: AssessOptions,\n): AccuracyAssessment {\n // ---- read and validate everything before judging anything -------------\n if (options !== undefined && !isRecord(options)) {\n throw new TypeError('options must be an object')\n }\n if (options !== undefined) {\n assertPlainObject(options, 'options')\n assertKnownKeys(options, OPTION_KEYS, 'options')\n }\n const confidenceRaw: unknown = options === undefined ? undefined : options.confidence\n const minNRaw: unknown = options === undefined ? undefined : options.minN\n const minAgreementRaw: unknown = options === undefined ? undefined : options.minAgreement\n const confidence =\n confidenceRaw === undefined ? DEFAULT_CONFIDENCE : readOpenUnit(confidenceRaw, 'options.confidence')\n // A level below one half is a typo (0.05 for 0.95): its \"interval\" is narrower\n // than the data's own noise and an \"at least\" statement built on it means nothing.\n if (confidence < MIN_ASSESS_CONFIDENCE) {\n throw new RangeError(`options.confidence must be at least ${String(MIN_ASSESS_CONFIDENCE)} for a verdict (0.95 is the default); got ${String(confidence)}`)\n }\n const z = zForConfidence(confidence)\n const minN = minNRaw === undefined ? DEFAULT_MIN_N : readCount(minNRaw, 'options.minN', 1)\n const minAgreement =\n minAgreementRaw === undefined ? undefined : readFiniteInRange(minAgreementRaw, 'options.minAgreement', -1, 1)\n const maxAgeRaw: unknown = options === undefined ? undefined : options.maxAgeDays\n const nowRaw: unknown = options === undefined ? undefined : options.now\n const requireScopeRaw: unknown = options === undefined ? undefined : options.requireScope\n const conservativeRaw: unknown = options === undefined ? undefined : options.conservative\n const strictPrecisionRaw: unknown = options === undefined ? undefined : options.strictPrecision\n const maxAgeDays = maxAgeRaw === undefined ? undefined : readCount(maxAgeRaw, 'options.maxAgeDays', 0)\n if (maxAgeDays !== undefined && nowRaw === undefined) {\n throw new TypeError('options.now is required with options.maxAgeDays: the kit never reads a clock')\n }\n const nowDay = nowRaw === undefined ? undefined : dayNumber(nowRaw, 'options.now')\n if (requireScopeRaw !== undefined && typeof requireScopeRaw !== 'boolean') {\n throw new TypeError('options.requireScope must be a boolean')\n }\n if (conservativeRaw !== undefined && typeof conservativeRaw !== 'boolean') {\n throw new TypeError('options.conservative must be a boolean')\n }\n if (strictPrecisionRaw !== undefined && typeof strictPrecisionRaw !== 'boolean') {\n throw new TypeError('options.strictPrecision must be a boolean')\n }\n const requireScope = requireScopeRaw === true\n const conservative = conservativeRaw === true\n // Excess printed precision is informational unless asked for, or in conservative mode.\n const strictPrecision = strictPrecisionRaw === true || conservative\n\n const root = requireRecord(input, 'input')\n assertKnownKeys(root, INPUT_KEYS, 'input')\n const claimRaw: unknown = root.claim\n const sampleRaw: unknown = root.sample\n const provenanceRaw: unknown = root.provenance\n const samplingRaw: unknown = root.sampling\n const strataRaw: unknown = root.strata\n const retractionsRaw: unknown = root.retractions\n const benchmarkRaw: unknown = root.benchmark\n const populationRaw: unknown = root.population\n const evaluatedAtRaw: unknown = root.evaluatedAt\n\n const claimRec = requireRecord(claimRaw, 'claim')\n assertKnownKeys(claimRec, CLAIM_KEYS, 'claim')\n const metricRaw: unknown = claimRec.metric\n const valueRaw: unknown = claimRec.value\n const displayRaw: unknown = claimRec.display\n const textRaw: unknown = claimRec.text\n\n // The metric: judged, or known-unsupported (refused below), or a typo (thrown).\n const { metric, judged } = readMetric(metricRaw)\n const higherIsBetter = judged && HIGHER_IS_BETTER.includes(metric as ClaimMetric)\n\n // A value is a proportion from 0 to 1 for a judged metric. An unsupported\n // metric (a word error rate can pass 1) only needs to be a number.\n const claimed = readFiniteInRange(valueRaw, 'claim.value', -Infinity, Infinity)\n // A value within the floating-point noise of 0 or 1 is the absolute claim of 0 or\n // 1 (ten 0.1s added up is 100%, not \"99.99999999999999% so matches 99.5%\"), and\n // that includes a computed value that overshoots by the noise (1.0000000000000002).\n // Further out it is not a proportion. `claimed` stays as supplied for the result;\n // every judgment uses `judgedValue`.\n if (judged && (claimed < -VALUE_NOISE || claimed > 1 + VALUE_NOISE)) {\n throw new RangeError(`claim.value must be a finite number between 0 and 1, got ${String(claimed)}`)\n }\n const judgedValue = judged ? snapAbsolute(claimed) : claimed\n\n if (displayRaw !== undefined && typeof displayRaw !== 'string') throw new TypeError('claim.display must be a string')\n let figure: DisplayFigure | undefined\n if (displayRaw !== undefined && judged) {\n figure = parseDisplayFigure(displayRaw, higherIsBetter)\n // Exact: the value must agree with the printed figure to its rounding plus\n // one ulp of the value. No float tolerance is involved.\n if (!figure.consistentWith(judgedValue)) {\n throw new RangeError(\n `claim.display \"${clip(displayRaw, 40)}\" (${pctNearest(figure.info.figure, 3).replace(/\\.?0+%$/, '%')}) does not match claim.value ${String(claimed)} (${pctNearest(claimed, 3).replace(/\\.?0+%$/, '%')}): ${figure.mismatchHint}`,\n )\n }\n }\n const displayIsPoint = figure !== undefined && figure.bound === null\n const displayDecimals =\n figure !== undefined && figure.info.form !== 'one-in-n' && figure.bound === null ? figure.info.decimals : null\n\n let claimText: string | undefined\n if (textRaw !== undefined) {\n if (typeof textRaw !== 'string') throw new TypeError('claim.text must be a string')\n if (textRaw.length > MAX_TEXT_LENGTH) throw new RangeError(`claim.text must be at most ${String(MAX_TEXT_LENGTH)} characters`)\n assertPlainText(textRaw, 'claim.text', 'put the claim on one line (join the lines with spaces) before passing it')\n claimText = textRaw\n }\n\n const counts = readSampleCounts(sampleRaw)\n\n const provRec = requireRecord(provenanceRaw, 'provenance')\n assertKnownKeys(provRec, PROVENANCE_KEYS, 'provenance')\n const sourceRaw: unknown = provRec.source\n const ratersRaw: unknown = provRec.raters\n const agreementRaw: unknown = provRec.agreement\n const source = readEnum(sourceRaw, SOURCES, 'provenance.source')\n const raters = ratersRaw === undefined ? undefined : readCount(ratersRaw, 'provenance.raters', 1)\n const agreement = agreementRaw === undefined ? undefined : readAgreement(agreementRaw)\n if (agreement !== undefined && raters !== undefined && raters < 2) {\n // Agreement is between raters; one rater cannot have produced it.\n throw new RangeError(`provenance.raters is ${String(raters)} but provenance.agreement was supplied; agreement needs at least 2 raters`)\n }\n\n const sampling = readEnum(samplingRaw, SAMPLINGS, 'sampling')\n const isFixedSet = sampling === 'complete' || sampling === 'held-out-split'\n\n let benchmarkName: string | undefined\n if (benchmarkRaw !== undefined) {\n const rec = requireRecord(benchmarkRaw, 'benchmark')\n assertKnownKeys(rec, BENCHMARK_KEYS, 'benchmark')\n const nameRaw: unknown = rec.name\n benchmarkName = readName(nameRaw, 'benchmark.name')\n if (!isFixedSet) {\n throw new RangeError(\"benchmark is only for sampling: 'complete' or 'held-out-split'\")\n }\n }\n\n let population: { claimed: string; evaluated: string } | undefined\n if (populationRaw !== undefined) {\n const rec = requireRecord(populationRaw, 'population')\n assertKnownKeys(rec, POPULATION_KEYS, 'population')\n const claimedRaw: unknown = rec.claimed\n const evaluatedRaw: unknown = rec.evaluated\n population = {\n claimed: readName(claimedRaw, 'population.claimed'),\n evaluated: readName(evaluatedRaw, 'population.evaluated'),\n }\n }\n\n const evaluatedDay = evaluatedAtRaw === undefined ? undefined : dayNumber(evaluatedAtRaw, 'evaluatedAt')\n if (evaluatedDay !== undefined && nowDay !== undefined && evaluatedDay > nowDay) {\n throw new RangeError('evaluatedAt is after options.now')\n }\n\n const strata = strataRaw === undefined ? undefined : readStrata(strataRaw)\n // The strata's own totals, as text for a refusal that asks for the pooled counts (null when none or too big to say)\n let strataTotals: string | null = null\n if (strata !== undefined) {\n // BigInt: a plain sum can round past 2^53 and falsely equal the total.\n let sumN = 0n\n let sumCorrect = 0n\n for (const s of strata) {\n sumN += BigInt(s.n)\n sumCorrect += BigInt(s.correct)\n }\n if (counts !== null) {\n if (sumN !== BigInt(counts.n) || sumCorrect !== BigInt(counts.correct)) {\n throw new RangeError('strata counts must add up to the sample counts')\n }\n } else if (sumN <= BigInt(MAX_COUNT)) {\n strataTotals = `{ n: ${String(sumN)}, correct: ${String(sumCorrect)} }`\n }\n }\n\n let retractionCount = 0\n let retractionsIncluded = true\n if (retractionsRaw !== undefined) {\n const rec = requireRecord(retractionsRaw, 'retractions')\n assertKnownKeys(rec, RETRACTION_KEYS, 'retractions')\n const countRaw: unknown = rec.count\n const includedRaw: unknown = rec.includedInSample\n retractionCount = readCount(countRaw, 'retractions.count', 0)\n if (typeof includedRaw !== 'boolean') {\n throw new TypeError('retractions.includedInSample must be a boolean')\n }\n retractionsIncluded = includedRaw\n if (retractionsIncluded && counts !== null && retractionCount > counts.n) {\n throw new RangeError('retractions.count is larger than the sample, so it cannot all be included')\n }\n }\n\n // Readers see the printed figure, so the more favorable of the value and the\n // parsed figure is what gets judged. A display that disagrees with the value\n // by more than its own rounding already threw above.\n let assessed = judgedValue\n let fromDisplay = false\n if (figure !== undefined) {\n const shown = figure.info.figure\n // A little noise apart is the same figure (82.7 / 100 against 0.827, 1 - 0.8 against\n // 0.2), not a more favorable one.\n const displayWins = beyondNoise(shown, judgedValue, higherIsBetter)\n if (displayWins) {\n assessed = shown\n fromDisplay = true\n }\n }\n const parsedDisplay = figure === undefined ? null : figure.info\n\n // Which optional checks this call actually ran. A gate that was asked for\n // ('applied') is different from one that was left out ('not-supplied').\n const checks: GateChecks = {\n retractions: retractionsRaw !== undefined ? 'applied' : 'not-supplied',\n scope: population !== undefined ? 'applied' : 'not-supplied',\n age: maxAgeDays !== undefined ? 'applied' : 'not-supplied',\n // applied = a minimum was required, or a statistic with a value and an n had its size checked;\n // a statistic that has no value is never examined unless a minimum asks for it\n agreement:\n minAgreement !== undefined || (agreement !== undefined && agreement.n !== null && agreement.value !== null) ? 'applied' : 'not-supplied',\n // applied = two or more strata could be compared; one stratum has nothing to differ from\n strata: strata !== undefined && strata.length > 1 && !isFixedSet ? 'applied' : 'not-supplied',\n }\n\n // ---- preconditions -----------------------------------------------------\n const refusals: ReasonCode[] = []\n const notes: string[] = []\n const metricWord = String(metric)\n\n if (!judged) {\n refusals.push('metric-not-supported')\n notes.push(`\"${clip(String(metric))}\" is not a proportion of independently checked items. This kit judges ${SUPPORTED_LIST}; for anything else, report the counts and method instead.`)\n }\n\n if (source === 'model') {\n refusals.push('no-human-labels')\n notes.push('The labels came from a model, not from people, so there is no human ground truth to count against.')\n } else if (source === 'unknown') {\n refusals.push('unknown-label-source')\n notes.push('The source of the labels is unknown, so it is not possible to tell whether people checked them.')\n } else if (source === 'mixed') {\n refusals.push('mixed-label-source')\n notes.push('Some labels came from a model. Count only the human-labeled items and assess those as a human sample.')\n }\n\n if (sampling === 'ranked') {\n refusals.push('ranked-sample')\n notes.push('The sample was chosen by rank (for example the top-scored items), which does not represent the rest.')\n } else if (sampling === 'convenience') {\n refusals.push('convenience-sample')\n notes.push('The sample is a convenience sample, so the interval does not describe any larger group.')\n } else if (sampling === 'unknown') {\n refusals.push('unknown-sampling')\n notes.push('How the sample was chosen is unknown, so the interval cannot be read as covering a larger group.')\n }\n\n if (sampling === 'stratified' && strata === undefined) {\n refusals.push('stratified-without-strata')\n notes.push('The sample is stratified but no strata were supplied. The pooled counts are not a simple random sample, so they cannot be read as the population rate; supply the strata.')\n }\n\n if (isFixedSet) {\n if (benchmarkName === undefined) {\n refusals.push('benchmark-unnamed')\n notes.push(\"A complete-set or held-out-split claim must name the fixed set it was measured on (the 'benchmark' field).\")\n } else if (claimText === undefined || !mentionsName(claimText, benchmarkName)) {\n refusals.push('claim-not-scoped-to-benchmark')\n notes.push(`The claim wording does not mention \"${clip(benchmarkName)}\". A score on a fixed set describes that set; word the claim for it, or supply a random sample for a general claim.`)\n }\n }\n\n if (counts === null) {\n refusals.push('n-undisclosed')\n notes.push(\n strataTotals === null\n ? 'The sample counts (n and correct or errors) were not supplied, so there is nothing to weigh the figure against.'\n : `The pooled sample counts (n and correct or errors) were not supplied. The strata hold them: pass sample: ${strataTotals}, their sums, with the strata.`,\n )\n } else if (!isFixedSet && counts.n < minN) {\n refusals.push('sample-too-small')\n notes.push(`The sample has ${String(counts.n)} items, below the minimum of ${String(minN)} needed for a verdict.`)\n }\n\n if (!isFixedSet && strata !== undefined && strata.length > 1) {\n // Bonferroni: split the error budget across the strata so that many\n // strata do not make a refusal likelier by chance alone.\n const zStrata = zForTail((1 - confidence) / (2 * strata.length))\n let highestLow = -Infinity\n let lowestHigh = Infinity\n let highestName = ''\n let lowestName = ''\n for (const s of strata) {\n const w = wilsonWithZ(s.correct, s.n, zStrata)\n if (w.low > highestLow) {\n highestLow = w.low\n highestName = s.name\n }\n if (w.high < lowestHigh) {\n lowestHigh = w.high\n lowestName = s.name\n }\n }\n if (highestLow - lowestHigh > COMPARISON_TOLERANCE) {\n refusals.push('merged-strata-differ')\n notes.push(\n `The strata do not agree: \"${clip(highestName)}\" and \"${clip(lowestName)}\" have intervals that do not overlap, so one combined figure hides a real difference. Report each stratum.`,\n )\n }\n }\n\n if (retractionCount > 0 && !retractionsIncluded) {\n refusals.push('retractions-not-included')\n notes.push(`${String(retractionCount)} retracted item(s) are known but are not counted in the sample.`)\n }\n\n if (maxAgeDays !== undefined && nowDay !== undefined) {\n if (evaluatedDay === undefined) {\n refusals.push('evaluation-date-missing')\n notes.push('A maximum age was set but no evaluation date (evaluatedAt) was supplied.')\n } else if (nowDay - evaluatedDay > maxAgeDays) {\n refusals.push('evaluation-stale')\n notes.push(`The evaluation is ${String(nowDay - evaluatedDay)} days old, over the allowed ${String(maxAgeDays)} days.`)\n }\n }\n\n if (population !== undefined) {\n if (foldText(population.claimed) !== foldText(population.evaluated)) {\n refusals.push('scope-mismatch')\n notes.push(`The claim covers \"${clip(population.claimed)}\" but the evaluation covered \"${clip(population.evaluated)}\".`)\n }\n } else if (requireScope) {\n refusals.push('scope-undeclared')\n notes.push('The claimed and evaluated populations were not declared (population).')\n }\n\n if (minAgreement !== undefined) {\n if (agreement === undefined) {\n refusals.push('agreement-missing')\n notes.push('A minimum agreement was required but no agreement statistic was supplied.')\n } else if (agreement.value === null) {\n refusals.push('agreement-undefined')\n notes.push(`${STATISTIC_LABEL[agreement.statistic]} is undefined for these labels, so the agreement requirement cannot be checked.`)\n } else if (agreement.value + COMPARISON_TOLERANCE < minAgreement) {\n refusals.push('agreement-below-minimum')\n notes.push(\n `${STATISTIC_LABEL[agreement.statistic]} is ${decimalCut(agreement.value, 3, 'down')}, below the required ${decimalCut(minAgreement, 3, 'up')}.`,\n )\n }\n }\n\n // An agreement statistic from a handful of items is noise (kappa of 1.0 from 6\n // pairs), whether or not a minimum is required. A hand-written statistic with\n // no n cannot be checked and is trusted.\n if (agreement !== undefined && agreement.value !== null && agreement.n !== null && agreement.n < minN) {\n refusals.push('agreement-sample-too-small')\n notes.push(`${STATISTIC_LABEL[agreement.statistic]} was computed on ${String(agreement.n)} items, below the minimum of ${String(minN)}, so it says too little about the raters to count.`)\n }\n\n if (refusals.length > 0 || counts === null) {\n const phrases = refusals.map((code) => REFUSAL_PHRASE[code] as string)\n return {\n verdict: 'refused',\n reasons: refusals,\n explanation: notes,\n metric,\n claimed,\n assessedValue: assessed,\n n: counts === null ? null : counts.n,\n basis: 'none',\n parsedDisplay,\n checks,\n interval: null,\n conservativeBound: null,\n suggestedStatement: `No ${metricWord} figure can be supported from this evidence: ${phrases.join('; ')}.`,\n }\n }\n\n const { n, correct } = counts\n const supportedMetric = metric as ClaimMetric\n const successes = higherIsBetter ? correct : n - correct\n const labelWord = LABEL_WORD[source as 'human' | 'automated' | 'by-construction']\n const datePart = evaluatedAtRaw === undefined ? '' : `, evaluated ${evaluatedAtRaw as string}`\n const metricName = METRIC_PHRASE[supportedMetric]\n\n // ---- complete set or held-out split: compare with the exact count ---------\n if (isFixedSet) {\n const k = successes\n const censusReasons: ReasonCode[] = []\n const censusNotes: string[] = []\n let censusVerdict: AccuracyVerdict\n const shown = Math.min(countDecimals(n), 2)\n const exactText = pctNearest(k / n, shown)\n // Every figure the reader can see is judged according to its form: a point\n // or approximate figure must match the count to its digits; a bound is an\n // inequality (strict ones exclude equality); a range and \"1 in N\" are judged\n // at their favorable end / precision band. The value is judged as a point\n // too whenever it is more favorable than the printed figure, or when the\n // printed figure is itself a point figure. 0 and 1 stay exact.\n const form = figure?.info.form\n const pointDisplay = form === 'percent' || form === 'approx'\n const valueMoreFavorable = figure !== undefined && beyondNoise(judgedValue, figure.info.figure, higherIsBetter)\n const displayOk = figure === undefined || figure.satisfiedBy(k, n)\n const valueOk =\n figure === undefined || valueMoreFavorable || pointDisplay ? matchesValue(judgedValue, k, n) : true\n const printedOnly = form === 'floor' || form === 'ceiling' || form === 'range' || form === 'one-in-n'\n const ok = displayOk && valueOk\n if (ok) {\n censusVerdict = 'supported'\n censusReasons.push('census-matches-count')\n censusNotes.push(`The figure ${printedOnly && form !== 'one-in-n' && form !== 'range' ? 'is consistent with' : 'matches'} the exact count (${String(k)} of ${String(n)}, ${exactText}) to ${figure === undefined ? VALUE_PRECISION : 'its printed precision'}.`)\n } else {\n censusVerdict = 'contradicted'\n censusReasons.push('claim-differs-from-count')\n censusNotes.push(`The figure does not match the exact count (${String(k)} of ${String(n)}, ${exactText}). It may be stale or mistyped.`)\n }\n if (figure !== undefined && figure.bandNote !== null) {\n censusNotes[0] = `${censusNotes[0] as string} ${figure.bandNote}`\n }\n let censusPrecisionNote = ''\n if (displayDecimals !== null && displayDecimals > countDecimals(n)) {\n if (strictPrecision && censusVerdict === 'supported') {\n censusReasons.length = 0\n censusNotes.length = 0\n censusVerdict = 'overstated'\n }\n censusReasons.push('precision-too-fine')\n censusNotes.push(`The figure is printed to ${placesWord(displayDecimals)}; ${String(n)} items resolve ${supportsWord(countDecimals(n))}.`)\n censusPrecisionNote = printAdvice(countDecimals(n))\n }\n const censusTextNote = textFigureNote(claimText, judgedValue, assessed, higherIsBetter)\n if (censusTextNote !== null) {\n censusReasons.push('text-figure-differs')\n censusNotes.push(censusTextNote)\n }\n const name = benchmarkName as string\n const counted = higherIsBetter ? `${String(k)} of ${String(n)} correct` : `${String(k)} of ${String(n)} wrong`\n const setWord = sampling === 'held-out-split' ? 'held-out split' : 'complete set'\n return {\n verdict: censusVerdict,\n reasons: censusReasons,\n explanation: censusNotes,\n metric,\n claimed,\n assessedValue: assessed,\n n,\n basis: 'census',\n parsedDisplay,\n checks,\n interval: null,\n conservativeBound: null,\n suggestedStatement: `${counted} on ${name} (${setWord}, ${labelWord}${datePart}): ${exactText} ${metricName === 'accurate' ? 'accuracy' : metricName}. This describes that set only; it is not an estimate for other data${censusPrecisionNote}`,\n }\n }\n\n // ---- the interval and the verdict ------------------------------------\n const w = wilsonWithZ(successes, n, z)\n const interval = { ...w, confidence, z, successes, n }\n const conservativeBound = higherIsBetter ? w.low : w.high\n const cl = confidenceLabel(confidence)\n // The tolerance absorbs binary noise at an interval limit. An exact 0 or 1 is\n // an absolute claim with no noise in it, and must never be excused: at about\n // 4e12 items the limit next to 0 or 1 is closer than the tolerance.\n const tolFor = (x: number): number => (x === 0 || x === 1 ? 0 : COMPARISON_TOLERANCE)\n\n let verdict: AccuracyVerdict\n const reasons: ReasonCode[] = []\n const explanation: string[] = []\n const claimedText = pctNearest(assessed, 3)\n const subject = fromDisplay\n ? `The printed figure ${claimedText} (more favorable than the claim value ${pctNearest(claimed, 3)})`\n : `The claimed ${claimedText}`\n const qualifier = higherIsBetter ? '' : ` ${metricName}`\n\n // An honest report of the observed rate: a point figure (not a bound, not 0 or\n // 100%) equal to successes / n to its printed precision. Never for a bound,\n // and not at all with options.conservative.\n const absolute = assessed === 0 || assessed === 1\n let matchesObserved = false\n if (!conservative && !absolute && (figure === undefined || displayIsPoint)) {\n // The printed figure must match the rate to its own precision; a value that\n // is more favorable than the printed figure must match as well, so a coarse\n // value cannot stand in for a precise print.\n const valueMoreFavorable = figure !== undefined && beyondNoise(judgedValue, figure.info.figure, higherIsBetter)\n matchesObserved =\n figure === undefined\n ? matchesValue(judgedValue, successes, n)\n : figure.matchesObserved(successes, n) && (!valueMoreFavorable || matchesValue(judgedValue, successes, n))\n }\n\n const top = pctCeil(w.high, 3)\n const bottom = pctFloor(w.low, 3)\n const observedText = `${String(successes)} of ${String(n)}`\n const strictBound = figure !== undefined && figure.strict\n // A bound claim is supported when it sits on the cautious side of the\n // interval's conservative end; a strict one (\"over 99%\") needs to clear it.\n // The value and the printed figure are each judged on their own terms: only\n // the printed bound carries the strictness.\n const clears = (x: number, strict: boolean): boolean => {\n const tol = tolFor(x)\n return higherIsBetter ? (strict ? x < w.low - tol : x <= w.low + tol) : strict ? x > w.high + tol : x >= w.high - tol\n }\n const withinBound = clears(judgedValue, false) && (figure === undefined || clears(figure.info.figure, strictBound))\n const matchesText = `matches the observed rate (${observedText}) to ${figure === undefined ? VALUE_PRECISION : 'its printed precision'}. The ${cl} Wilson interval is ${bottom} to ${top}.`\n if (withinBound) {\n verdict = 'supported'\n reasons.push('claim-within-bound')\n explanation.push(\n higherIsBetter\n ? `${subject} is ${strictBound ? 'below' : 'no higher than'} the lower end of the ${cl} Wilson interval (${bottom}).`\n : `${subject}${qualifier} is ${strictBound ? 'above' : 'no lower than'} the upper end of the ${cl} Wilson interval (${top}).`,\n )\n } else if (matchesObserved) {\n // An honest report of the observed rate comes first: a rounded figure can\n // land just outside the interval it was rounded from.\n verdict = 'supported'\n reasons.push('matches-observed-rate')\n explanation.push(`${subject}${qualifier} ${matchesText}`)\n } else if (higherIsBetter ? assessed > w.high + tolFor(assessed) : assessed < w.low - tolFor(assessed)) {\n verdict = 'contradicted'\n reasons.push('claim-outside-interval')\n // At a sample of billions of items one wrong item leaves the limit within a rounding of 100% (or 0%):\n // the limit is still on the near side of the claim, so say that instead of printing a bare 100%.\n const nearCertain = higherIsBetter\n ? successes < n && top === pctCeil(1, 3)\n ? ', which is just under 100% because not every item was counted right'\n : null\n : successes > 0 && bottom === pctFloor(0, 3)\n ? ', which is just above 0% because at least one error was counted'\n : null\n explanation.push(\n higherIsBetter\n ? `${subject} is above the top of the ${cl} Wilson interval${nearCertain ?? ` (${top})`}.`\n : `${subject}${qualifier} is below the bottom of the ${cl} Wilson interval${nearCertain ?? ` (${bottom})`}.`,\n )\n } else {\n verdict = 'overstated'\n reasons.push('claim-beyond-conservative-bound')\n if (absolute) {\n // 100% (or 0%) is certainty: the Wilson interval itself ends at 1 (or 0) when every item agreed,\n // but the conservative limit never establishes it.\n explanation.push(\n higherIsBetter\n ? `${subject} cannot be stated from a sample: even when every item was right (${observedText}), the conservative lower limit cannot establish 100%. The most the evidence supports is ${bottom}, the lower end of the ${cl} Wilson interval.`\n : `${subject}${qualifier} cannot be stated from a sample: even when no item was wrong (${observedText}), the conservative upper limit cannot establish 0%. The least the evidence supports is ${top}, the upper end of the ${cl} Wilson interval.`,\n )\n } else {\n let sentence = higherIsBetter\n ? `${subject} is inside the ${cl} Wilson interval but above its lower end (${bottom}), which is the most the evidence supports.`\n : `${subject}${qualifier} is inside the ${cl} Wilson interval but below its upper end (${top}), which is the least the evidence supports.`\n // A bound printed rounded to the nearest digit (\"99.1%+\" from a limit of 99.046%) can land\n // just past the limit; the figure to print is the limit rounded in the cautious direction.\n const printedDecimals = figure !== undefined && figure.bound !== null ? figure.info.decimals : null\n if (printedDecimals !== null && figure !== undefined) {\n const oneUnit = 10 ** -(printedDecimals + 2)\n if (higherIsBetter && figure.bound === 'floor' && assessed - w.low < oneUnit) {\n sentence += ` The shortfall is within the rounding of the last printed digit, so print the bound rounded down: ${pctFloor(w.low, printedDecimals)}.`\n } else if (!higherIsBetter && figure.bound === 'ceiling' && w.high - assessed < oneUnit) {\n sentence += ` The shortfall is within the rounding of the last printed digit, so print the bound rounded up: ${pctCeil(w.high, printedDecimals)}.`\n }\n }\n // A figure on the cautious side of the observed rate is the usual honest round-down or\n // truncation (99.6 printed as 99): say so, and what to print instead. Only advise a figure the\n // same assessment would pass (see observedAdvice): the observed rate is no way out when it is 0\n // or 100% (a sample cannot show certainty), with options.conservative, or when no display\n // within the precision strictPrecision allows can match it; the bound is printed at the\n // precision the interval permits when strictPrecision or conservative is set.\n if (beyondNoise(w.point, assessed, higherIsBetter)) {\n const allowed = maxDisplayDecimals(w.high - w.low)\n const printDecimals = strictPrecision ? allowed : Math.min(allowed + 2, 5)\n const observedFigure = conservative ? null : observedAdvice(w.point, successes, n, strictPrecision ? allowed : null, higherIsBetter)\n // The default observed figure is the one the sentence already quotes at three decimals;\n // only a different figure (a precision limit, or more digits to keep it off 100%) is spelled out.\n const observedPart =\n observedFigure === null\n ? ''\n : !strictPrecision && observedFigure === pctNearest(w.point, 3)\n ? 'print the observed rate, or '\n : `print the observed rate (${observedFigure}), or `\n // The bound at the permitted precision is cut in the cautious direction, so it is never\n // beyond the conservative end and always passes as a claim of its own.\n const lead = higherIsBetter\n ? ` The figure is also below the observed rate (${observedText}, ${pctNearest(w.point, 3)}): `\n : ` The figure is also above the observed rate (${observedText}, ${pctNearest(w.point, 3)}): `\n sentence += higherIsBetter\n ? `${lead}${observedPart}go down to the lower end (${pctFloor(w.low, printDecimals)}).`\n : `${lead}${observedPart}go up to the upper end (${pctCeil(w.high, printDecimals)}).`\n }\n explanation.push(sentence)\n }\n }\n\n if (figure !== undefined && figure.bandNote !== null) {\n explanation[0] = `${explanation[0] as string} ${figure.bandNote}`\n }\n\n let precisionNote = ''\n if (displayDecimals !== null) {\n const allowed = maxDisplayDecimals(w.high - w.low)\n if (displayDecimals > allowed) {\n const text = `The figure is printed to ${placesWord(displayDecimals)}, but the interval is ${pctNearest(w.high - w.low, 2).replace('%', '')} percentage points wide and supports ${supportsWord(allowed)}.`\n if (strictPrecision && verdict === 'supported') {\n // The value itself is fine; only the printed precision overreaches.\n reasons.length = 0\n explanation.length = 0\n verdict = 'overstated'\n }\n reasons.push('precision-too-fine')\n explanation.push(text)\n precisionNote = printAdvice(allowed)\n }\n }\n\n // A claim far less favorable than the counts (outside the 99.9% interval on\n // the pessimistic side) looks like a stale or mistyped figure. Informational:\n // the verdict is unchanged.\n if (verdict !== 'contradicted') {\n const wide = wilsonWithZ(successes, n, zForConfidence(0.999))\n const worse = higherIsBetter ? assessed < wide.low - tolFor(assessed) : assessed > wide.high + tolFor(assessed)\n if (worse) {\n reasons.push('claim-worse-than-counts')\n explanation.push(\n `${subject} is far less favorable than the counts support (the 99.9% Wilson interval is ${pctFloor(wide.low, 3)} to ${pctCeil(wide.high, 3)}). If this is a published figure it may be stale or wrong.`,\n )\n }\n }\n\n // The interval pools the strata as one simple random sample. It is not\n // reweighted by population share, and the kit has no population shares to\n // reweight with, so a stratified result says so (informational).\n if (sampling === 'stratified') {\n reasons.push('strata-not-reweighted')\n explanation.push('The strata are pooled as one sample and not reweighted by population share, so the interval describes the pooled counts, not the population, unless each stratum was sampled in proportion to its size. Report each stratum, or reweight them yourself.')\n }\n\n const textNote = textFigureNote(claimText, judgedValue, assessed, higherIsBetter)\n if (textNote !== null) {\n reasons.push('text-figure-differs')\n explanation.push(textNote)\n }\n\n // ---- statement ---------------------------------------------------------\n // One precision for the headline bound and the interval it quotes.\n const decimals = Math.min(maxDisplayDecimals(w.high - w.low) + 2, 5)\n // The lead names the scope first: the figure is about this sample (or the\n // declared evaluated population), so a pasted headline cannot read as a\n // property of the system.\n const scope = population === undefined ? 'On this sample' : `On this sample of ${population.evaluated}`\n const headline = higherIsBetter\n ? `${scope}, at least ${pctFloor(w.low, decimals)} ${metricName}`\n : `${scope}, at most ${pctCeil(w.high, decimals)} ${metricName}`\n const caveat = sampling === 'cross-validation' ? SAMPLING_ERROR_ONLY_CV : SAMPLING_ERROR_ONLY\n const parts = [\n `${cl} Wilson interval ${pctFloor(w.low, decimals)} to ${pctCeil(w.high, decimals)}`,\n `n = ${String(n)}`,\n labelWord,\n SAMPLE_WORD[sampling] ?? 'random sample',\n ]\n if (evaluatedAtRaw !== undefined) parts.push(`evaluated ${evaluatedAtRaw as string}`)\n if (agreement !== undefined && agreement.value !== null) {\n parts.push(`${STATISTIC_LABEL[agreement.statistic]} ${decimalCut(agreement.value, 2, 'down')}`)\n }\n return {\n verdict,\n reasons,\n explanation,\n metric,\n claimed,\n assessedValue: assessed,\n n,\n basis: 'wilson-interval',\n parsedDisplay,\n checks,\n interval,\n conservativeBound,\n suggestedStatement: `${headline} (${parts.join(', ')}); ${caveat}${precisionNote}`,\n }\n}\n"]}
|
package/dist/census.d.ts
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The decimal digits a number is written with, read from its shortest
|
|
3
|
+
* round-trip text (never from binary expansion): 0.799 -> digits 799, scale 3;
|
|
4
|
+
* 5e-7 -> digits 5, scale 7 (value = digits / 10^scale).
|
|
5
|
+
*
|
|
6
|
+
* A double within VALUE_NOISE of a shorter decimal is read as that decimal, so
|
|
7
|
+
* the noisy results of 82.7 / 100 (0.8270000000000001), 82.7 * 0.01 and
|
|
8
|
+
* 1 - 800 / 1000 (0.19999999999999996) read as 0.827 and 0.2 and not as a
|
|
9
|
+
* sixteen-digit figure nobody wrote.
|
|
10
|
+
*/
|
|
11
|
+
export declare function valueDigits(value: number): {
|
|
12
|
+
digits: bigint;
|
|
13
|
+
scale: number;
|
|
14
|
+
};
|
|
15
|
+
/** The shortest decimal text (from 1 to 16 significant digits) within VALUE_NOISE of `value`, else its round-trip text. */
|
|
16
|
+
export declare function shortestWithinNoise(value: number): string;
|
|
17
|
+
/**
|
|
18
|
+
* True when the printed figure digits / 10^scale matches k / n:
|
|
19
|
+
* 0 matches only k = 0, 1 matches only k = n (an absolute claim is never
|
|
20
|
+
* rounded), and otherwise |digits / 10^scale - k / n| <= 1/2 * 10^-scale.
|
|
21
|
+
* Exact integer arithmetic.
|
|
22
|
+
*/
|
|
23
|
+
export declare function matchesCount(digits: bigint, scale: number, k: number, n: number): boolean;
|
|
24
|
+
/**
|
|
25
|
+
* The finest decimal place a bare value can be read at is a whole percent:
|
|
26
|
+
* 0.9 means 90%, within half a point, never 90 plus or minus 5 points. A value
|
|
27
|
+
* written with more digits keeps them.
|
|
28
|
+
*/
|
|
29
|
+
export declare const COARSEST_VALUE_SCALE = 2;
|
|
30
|
+
/**
|
|
31
|
+
* True when the double `x` matches k / n: 0 and 1 are exact claims (a value
|
|
32
|
+
* within VALUE_NOISE of either is that claim; see snapAbsolute); otherwise the
|
|
33
|
+
* decimal `x` is written as (see valueDigits) must be within half a unit of
|
|
34
|
+
* its own last digit (never coarser than a whole percent) plus VALUE_NOISE of
|
|
35
|
+
* k / n, so a value computed as k / n, or as 1 - (n - k) / n, in floating point
|
|
36
|
+
* matches its own count and a value a little off a rounded figure is judged
|
|
37
|
+
* like that figure. Exact integer arithmetic.
|
|
38
|
+
*/
|
|
39
|
+
export declare function matchesValue(x: number, k: number, n: number): boolean;
|
|
40
|
+
/**
|
|
41
|
+
* Most percent decimals worth printing for a count out of n: the largest d
|
|
42
|
+
* with 10^(d+2) <= 10 n. Digits past that only restate the fraction k / n.
|
|
43
|
+
*/
|
|
44
|
+
export declare function countDecimals(n: number): number;
|
package/dist/census.js
ADDED
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
// Exact helpers for claims about a complete, fixed set (a benchmark): there is
|
|
2
|
+
// no sampling, so the claim is compared with the exact count, not an interval.
|
|
3
|
+
import { VALUE_NOISE, VALUE_NOISE_EXPONENT, snapAbsolute } from './exact.js';
|
|
4
|
+
/**
|
|
5
|
+
* The decimal digits a number is written with, read from its shortest
|
|
6
|
+
* round-trip text (never from binary expansion): 0.799 -> digits 799, scale 3;
|
|
7
|
+
* 5e-7 -> digits 5, scale 7 (value = digits / 10^scale).
|
|
8
|
+
*
|
|
9
|
+
* A double within VALUE_NOISE of a shorter decimal is read as that decimal, so
|
|
10
|
+
* the noisy results of 82.7 / 100 (0.8270000000000001), 82.7 * 0.01 and
|
|
11
|
+
* 1 - 800 / 1000 (0.19999999999999996) read as 0.827 and 0.2 and not as a
|
|
12
|
+
* sixteen-digit figure nobody wrote.
|
|
13
|
+
*/
|
|
14
|
+
export function valueDigits(value) {
|
|
15
|
+
const text = shortestWithinNoise(value);
|
|
16
|
+
const at = text.indexOf('e');
|
|
17
|
+
const mantissa = at < 0 ? text : text.slice(0, at);
|
|
18
|
+
const exponent = at < 0 ? 0 : Number(text.slice(at + 1));
|
|
19
|
+
const dot = mantissa.indexOf('.');
|
|
20
|
+
const whole = dot < 0 ? mantissa : mantissa.slice(0, dot);
|
|
21
|
+
let fraction = dot < 0 ? '' : mantissa.slice(dot + 1);
|
|
22
|
+
let end = fraction.length;
|
|
23
|
+
while (end > 0 && fraction.charCodeAt(end - 1) === 48)
|
|
24
|
+
end -= 1; // trailing zeros, scanned from the end
|
|
25
|
+
fraction = fraction.slice(0, end);
|
|
26
|
+
return { digits: BigInt(`${whole}${fraction}`), scale: fraction.length - exponent };
|
|
27
|
+
}
|
|
28
|
+
/** The shortest decimal text (from 1 to 16 significant digits) within VALUE_NOISE of `value`, else its round-trip text. */
|
|
29
|
+
export function shortestWithinNoise(value) {
|
|
30
|
+
if (value === 0)
|
|
31
|
+
return '0';
|
|
32
|
+
for (let digits = 1; digits <= 16; digits++) {
|
|
33
|
+
const text = value.toPrecision(digits);
|
|
34
|
+
if (Math.abs(Number(text) - value) <= VALUE_NOISE)
|
|
35
|
+
return text;
|
|
36
|
+
}
|
|
37
|
+
return String(value);
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* True when the printed figure digits / 10^scale matches k / n:
|
|
41
|
+
* 0 matches only k = 0, 1 matches only k = n (an absolute claim is never
|
|
42
|
+
* rounded), and otherwise |digits / 10^scale - k / n| <= 1/2 * 10^-scale.
|
|
43
|
+
* Exact integer arithmetic.
|
|
44
|
+
*/
|
|
45
|
+
export function matchesCount(digits, scale, k, n) {
|
|
46
|
+
if (digits === 0n)
|
|
47
|
+
return k === 0;
|
|
48
|
+
if (digits === 10n ** BigInt(scale))
|
|
49
|
+
return k === n;
|
|
50
|
+
const lhs = digits * BigInt(n) - BigInt(k) * 10n ** BigInt(scale);
|
|
51
|
+
return 2n * (lhs < 0n ? -lhs : lhs) <= BigInt(n);
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* The finest decimal place a bare value can be read at is a whole percent:
|
|
55
|
+
* 0.9 means 90%, within half a point, never 90 plus or minus 5 points. A value
|
|
56
|
+
* written with more digits keeps them.
|
|
57
|
+
*/
|
|
58
|
+
export const COARSEST_VALUE_SCALE = 2;
|
|
59
|
+
/**
|
|
60
|
+
* True when the double `x` matches k / n: 0 and 1 are exact claims (a value
|
|
61
|
+
* within VALUE_NOISE of either is that claim; see snapAbsolute); otherwise the
|
|
62
|
+
* decimal `x` is written as (see valueDigits) must be within half a unit of
|
|
63
|
+
* its own last digit (never coarser than a whole percent) plus VALUE_NOISE of
|
|
64
|
+
* k / n, so a value computed as k / n, or as 1 - (n - k) / n, in floating point
|
|
65
|
+
* matches its own count and a value a little off a rounded figure is judged
|
|
66
|
+
* like that figure. Exact integer arithmetic.
|
|
67
|
+
*/
|
|
68
|
+
export function matchesValue(x, k, n) {
|
|
69
|
+
const exact = snapAbsolute(x);
|
|
70
|
+
if (exact === 0)
|
|
71
|
+
return k === 0;
|
|
72
|
+
if (exact === 1)
|
|
73
|
+
return k === n;
|
|
74
|
+
const { digits, scale: own } = valueDigits(x);
|
|
75
|
+
const half = 10n ** BigInt(Math.max(own, COARSEST_VALUE_SCALE)); // half a unit is 1 / (2 half)
|
|
76
|
+
const written = 10n ** BigInt(own);
|
|
77
|
+
const bn = BigInt(n);
|
|
78
|
+
// |digits / written - k / n| <= 1 / (2 half) + 2^NOISE_EXPONENT, multiplied
|
|
79
|
+
// through by 2 half written n 2^-NOISE_EXPONENT
|
|
80
|
+
const shift = BigInt(-VALUE_NOISE_EXPONENT);
|
|
81
|
+
const gap = digits * bn - BigInt(k) * written;
|
|
82
|
+
return ((2n * half * (gap < 0n ? -gap : gap)) << shift) <= ((written * bn) << shift) + 2n * half * written * bn;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Most percent decimals worth printing for a count out of n: the largest d
|
|
86
|
+
* with 10^(d+2) <= 10 n. Digits past that only restate the fraction k / n.
|
|
87
|
+
*/
|
|
88
|
+
export function countDecimals(n) {
|
|
89
|
+
const limit = 10n * BigInt(n);
|
|
90
|
+
let d = 0;
|
|
91
|
+
while (limit >= 10n ** BigInt(d + 3))
|
|
92
|
+
d += 1;
|
|
93
|
+
return d;
|
|
94
|
+
}
|
|
95
|
+
//# sourceMappingURL=census.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"census.js","sourceRoot":"","sources":["../src/census.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,+EAA+E;AAE/E,OAAO,EAAE,WAAW,EAAE,oBAAoB,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AAE5E;;;;;;;;;GASG;AACH,MAAM,UAAU,WAAW,CAAC,KAAa;IACvC,MAAM,IAAI,GAAG,mBAAmB,CAAC,KAAK,CAAC,CAAA;IACvC,MAAM,EAAE,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAA;IAC5B,MAAM,QAAQ,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAA;IAClD,MAAM,QAAQ,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,CAAA;IACxD,MAAM,GAAG,GAAG,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,CAAA;IACjC,MAAM,KAAK,GAAG,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ,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OAAO,CAAC,CAAC,EAAE,GAAG,IAAI,GAAG,CAAC,GAAG,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,KAAK,CAAC,IAAI,CAAC,CAAC,OAAO,GAAG,EAAE,CAAC,IAAI,KAAK,CAAC,GAAG,EAAE,GAAG,IAAI,GAAG,OAAO,GAAG,EAAE,CAAA;AACjH,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,aAAa,CAAC,CAAS;IACrC,MAAM,KAAK,GAAG,GAAG,GAAG,MAAM,CAAC,CAAC,CAAC,CAAA;IAC7B,IAAI,CAAC,GAAG,CAAC,CAAA;IACT,OAAO,KAAK,IAAI,GAAG,IAAI,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC;QAAE,CAAC,IAAI,CAAC,CAAA;IAC5C,OAAO,CAAC,CAAA;AACV,CAAC","sourcesContent":["// Exact helpers for claims about a complete, fixed set (a benchmark): there is\n// no sampling, so the claim is compared with the exact count, not an interval.\n\nimport { VALUE_NOISE, VALUE_NOISE_EXPONENT, snapAbsolute } from './exact.js'\n\n/**\n * The decimal digits a number is written with, read from its shortest\n * round-trip text (never from binary expansion): 0.799 -> digits 799, scale 3;\n * 5e-7 -> digits 5, scale 7 (value = digits / 10^scale).\n *\n * A double within VALUE_NOISE of a shorter decimal is read as that decimal, so\n * the noisy results of 82.7 / 100 (0.8270000000000001), 82.7 * 0.01 and\n * 1 - 800 / 1000 (0.19999999999999996) read as 0.827 and 0.2 and not as a\n * sixteen-digit figure nobody wrote.\n */\nexport function valueDigits(value: number): { digits: bigint; scale: number } {\n const text = shortestWithinNoise(value)\n const at = text.indexOf('e')\n const mantissa = at < 0 ? text : text.slice(0, at)\n const exponent = at < 0 ? 0 : Number(text.slice(at + 1))\n const dot = mantissa.indexOf('.')\n const whole = dot < 0 ? mantissa : mantissa.slice(0, dot)\n let fraction = dot < 0 ? '' : mantissa.slice(dot + 1)\n let end = fraction.length\n while (end > 0 && fraction.charCodeAt(end - 1) === 48) end -= 1 // trailing zeros, scanned from the end\n fraction = fraction.slice(0, end)\n return { digits: BigInt(`${whole}${fraction}`), scale: fraction.length - exponent }\n}\n\n/** The shortest decimal text (from 1 to 16 significant digits) within VALUE_NOISE of `value`, else its round-trip text. */\nexport function shortestWithinNoise(value: number): string {\n if (value === 0) return '0'\n for (let digits = 1; digits <= 16; digits++) {\n const text = value.toPrecision(digits)\n if (Math.abs(Number(text) - value) <= VALUE_NOISE) return text\n }\n return String(value)\n}\n\n/**\n * True when the printed figure digits / 10^scale matches k / n:\n * 0 matches only k = 0, 1 matches only k = n (an absolute claim is never\n * rounded), and otherwise |digits / 10^scale - k / n| <= 1/2 * 10^-scale.\n * Exact integer arithmetic.\n */\nexport function matchesCount(digits: bigint, scale: number, k: number, n: number): boolean {\n if (digits === 0n) return k === 0\n if (digits === 10n ** BigInt(scale)) return k === n\n const lhs = digits * BigInt(n) - BigInt(k) * 10n ** BigInt(scale)\n return 2n * (lhs < 0n ? -lhs : lhs) <= BigInt(n)\n}\n\n/**\n * The finest decimal place a bare value can be read at is a whole percent:\n * 0.9 means 90%, within half a point, never 90 plus or minus 5 points. A value\n * written with more digits keeps them.\n */\nexport const COARSEST_VALUE_SCALE = 2\n\n/**\n * True when the double `x` matches k / n: 0 and 1 are exact claims (a value\n * within VALUE_NOISE of either is that claim; see snapAbsolute); otherwise the\n * decimal `x` is written as (see valueDigits) must be within half a unit of\n * its own last digit (never coarser than a whole percent) plus VALUE_NOISE of\n * k / n, so a value computed as k / n, or as 1 - (n - k) / n, in floating point\n * matches its own count and a value a little off a rounded figure is judged\n * like that figure. Exact integer arithmetic.\n */\nexport function matchesValue(x: number, k: number, n: number): boolean {\n const exact = snapAbsolute(x)\n if (exact === 0) return k === 0\n if (exact === 1) return k === n\n const { digits, scale: own } = valueDigits(x)\n const half = 10n ** BigInt(Math.max(own, COARSEST_VALUE_SCALE)) // half a unit is 1 / (2 half)\n const written = 10n ** BigInt(own)\n const bn = BigInt(n)\n // |digits / written - k / n| <= 1 / (2 half) + 2^NOISE_EXPONENT, multiplied\n // through by 2 half written n 2^-NOISE_EXPONENT\n const shift = BigInt(-VALUE_NOISE_EXPONENT)\n const gap = digits * bn - BigInt(k) * written\n return ((2n * half * (gap < 0n ? -gap : gap)) << shift) <= ((written * bn) << shift) + 2n * half * written * bn\n}\n\n/**\n * Most percent decimals worth printing for a count out of n: the largest d\n * with 10^(d+2) <= 10 n. Digits past that only restate the fraction k / n.\n */\nexport function countDecimals(n: number): number {\n const limit = 10n * BigInt(n)\n let d = 0\n while (limit >= 10n ** BigInt(d + 3)) d += 1\n return d\n}\n"]}
|
package/dist/dates.d.ts
ADDED
package/dist/dates.js
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
// Calendar-date handling with no clock: callers pass both dates in.
|
|
2
|
+
import { clip } from './validate.js';
|
|
3
|
+
const DAY_MS = 86_400_000;
|
|
4
|
+
const DATE = /^(\d{4})-(\d{2})-(\d{2})$/;
|
|
5
|
+
/** Days since 1970-01-01 (UTC) for a real "YYYY-MM-DD" date. TypeError / RangeError otherwise. */
|
|
6
|
+
export function dayNumber(value, name) {
|
|
7
|
+
if (typeof value !== 'string')
|
|
8
|
+
throw new TypeError(`${name} must be a "YYYY-MM-DD" string`);
|
|
9
|
+
const m = DATE.exec(value);
|
|
10
|
+
if (m === null)
|
|
11
|
+
throw new RangeError(`${name} must look like "2026-10-10"; got "${clip(value, 40)}"`);
|
|
12
|
+
const year = Number(m[1]);
|
|
13
|
+
const month = Number(m[2]);
|
|
14
|
+
const day = Number(m[3]);
|
|
15
|
+
if (year < 1000)
|
|
16
|
+
throw new RangeError(`${name} year must be 1000 or later`);
|
|
17
|
+
const date = new Date(Date.UTC(year, month - 1, day));
|
|
18
|
+
if (date.getUTCFullYear() !== year || date.getUTCMonth() !== month - 1 || date.getUTCDate() !== day) {
|
|
19
|
+
throw new RangeError(`${name} is not a real calendar date: "${value}"`);
|
|
20
|
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AAI,IAAI,CAAC,UAAU,EAAE,KAAK,GAAG,EAAE,CAAC;QACpG,MAAM,IAAI,UAAU,CAAC,GAAG,IAAI,kCAAkC,KAAK,GAAG,CAAC,CAAA;IACzE,CAAC;IACD,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,EAAE,GAAG,MAAM,CAAC,CAAA;AAC5C,CAAC","sourcesContent":["// Calendar-date handling with no clock: callers pass both dates in.\n\nimport { clip } from './validate.js'\n\nconst DAY_MS = 86_400_000\nconst DATE = /^(\\d{4})-(\\d{2})-(\\d{2})$/\n\n/** Days since 1970-01-01 (UTC) for a real \"YYYY-MM-DD\" date. TypeError / RangeError otherwise. */\nexport function dayNumber(value: unknown, name: string): number {\n if (typeof value !== 'string') throw new TypeError(`${name} must be a \"YYYY-MM-DD\" string`)\n const m = DATE.exec(value)\n if (m === null) throw new RangeError(`${name} must look like \"2026-10-10\"; got \"${clip(value, 40)}\"`)\n const year = Number(m[1])\n const month = Number(m[2])\n const day = Number(m[3])\n if (year < 1000) throw new RangeError(`${name} year must be 1000 or later`)\n const date = new Date(Date.UTC(year, month - 1, day))\n if (date.getUTCFullYear() !== year || date.getUTCMonth() !== month - 1 || date.getUTCDate() !== day) {\n throw new RangeError(`${name} is not a real calendar date: \"${value}\"`)\n }\n return Math.round(date.getTime() / DAY_MS)\n}\n"]}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
export type DisplayForm = 'percent' | 'approx' | 'floor' | 'ceiling' | 'range' | 'one-in-n';
|
|
2
|
+
/** What a result records about the parsed display. */
|
|
3
|
+
export interface ParsedDisplayInfo {
|
|
4
|
+
form: DisplayForm;
|
|
5
|
+
/** The figure judged, as a proportion (0.99 for "99%+"). */
|
|
6
|
+
figure: number;
|
|
7
|
+
/** Decimal places of the printed percent, or null for "1 in N". */
|
|
8
|
+
decimals: number | null;
|
|
9
|
+
}
|
|
10
|
+
export interface DisplayFigure {
|
|
11
|
+
info: ParsedDisplayInfo;
|
|
12
|
+
/** "floor" for "99%+" style claims, "ceiling" for "<1%", else null. */
|
|
13
|
+
bound: 'floor' | 'ceiling' | null;
|
|
14
|
+
/** True for "over 99%" / "<1%": the bound itself does not satisfy the claim. */
|
|
15
|
+
strict: boolean;
|
|
16
|
+
/** True when the printed value agrees with `value` to its rounding (plus one ulp). */
|
|
17
|
+
consistentWith(value: number): boolean;
|
|
18
|
+
/** What the value had to satisfy when it disagrees with this figure, as the end of an error message. */
|
|
19
|
+
mismatchHint: string;
|
|
20
|
+
/** For "1 in N": what band N was read at, to put in an explanation; null for every other form. */
|
|
21
|
+
bandNote: string | null;
|
|
22
|
+
/**
|
|
23
|
+
* True when `value` is what this figure says: a point, approximate figure, range or
|
|
24
|
+
* "1 in N" within its printed rounding, a floor at or below the value, a ceiling at or
|
|
25
|
+
* above it (strict bounds exclude equality). One ulp of representation error is allowed.
|
|
26
|
+
*/
|
|
27
|
+
agreesWith(value: number): boolean;
|
|
28
|
+
/** True when the observed rate k / n equals the figure to its printed precision. */
|
|
29
|
+
matchesObserved(k: number, n: number): boolean;
|
|
30
|
+
/**
|
|
31
|
+
* Census check of the printed figure against the exact count k / n: a bound as
|
|
32
|
+
* an inequality (strict ones exclude equality), a point, range end or "1 in N"
|
|
33
|
+
* as a match to its printed precision.
|
|
34
|
+
*/
|
|
35
|
+
satisfiedBy(k: number, n: number): boolean;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Parses the display for a metric where higher is better (accuracy, precision,
|
|
39
|
+
* recall) or lower is better (error rates). Throws TypeError for a non-string
|
|
40
|
+
* and RangeError for text that is not one of the forms above, or a bound that
|
|
41
|
+
* points the wrong way for the metric ("<99%" accuracy).
|
|
42
|
+
*/
|
|
43
|
+
export declare function parseDisplayFigure(display: unknown, higherIsBetter: boolean): DisplayFigure;
|
|
44
|
+
/**
|
|
45
|
+
* The figures in `text` that say something other than the judged figure, as
|
|
46
|
+
* written (folded). A figure is read by the same parser as `claim.display`;
|
|
47
|
+
* one that cannot be read (a bound pointing the wrong way for the metric, an
|
|
48
|
+
* impossible percent) is skipped. A figure agrees when it describes `value` or
|
|
49
|
+
* `assessed` (the value, or the printed display that was judged instead), or,
|
|
50
|
+
* for a point, approximate or range figure, their complement ("87.7% right"
|
|
51
|
+
* beside a 12.3% error rate). A printed 100% or 0% is absolute: it describes
|
|
52
|
+
* only a value of exactly 1 or 0, never 99.6% that rounds to it. The words perfect, flawless, error-free, no
|
|
53
|
+
* errors and zero errors mean 100% (0% for a lower-is-better metric). The
|
|
54
|
+
* text is only scanned, never judged: nothing here changes a verdict.
|
|
55
|
+
*/
|
|
56
|
+
export declare function textFiguresDiffering(text: string, value: number, assessed: number, higherIsBetter: boolean): string[];
|