From f2b97e1df59c970b57dd1628d599a1ad53db7955 Mon Sep 17 00:00:00 2001 From: Jakob Langdal Date: Thu, 2 Jul 2026 21:21:29 +0000 Subject: [PATCH] fix(core): format 95% CI as [lower to upper] to match the 1D plots --- .changeset/ci-interval-to-format.md | 6 ++++++ packages/core/src/common/util/scores/quality.test.ts | 2 +- packages/core/src/common/util/scores/quality.ts | 4 ++-- 3 files changed, 9 insertions(+), 3 deletions(-) create mode 100644 .changeset/ci-interval-to-format.md diff --git a/.changeset/ci-interval-to-format.md b/.changeset/ci-interval-to-format.md new file mode 100644 index 00000000..1383d913 --- /dev/null +++ b/.changeset/ci-interval-to-format.md @@ -0,0 +1,6 @@ +--- +'@boostv/process-optimizer-frontend-core': patch +'@boostv/process-optimizer-frontend-plots': patch +--- + +Format 95% credible intervals as [lower to upper] instead of [lower, upper], matching the 1D plots' hover format. Applies to the pareto front hover label and the credible-interval column under the plots (the plots package inlines these helpers and is republished to pick up the change). diff --git a/packages/core/src/common/util/scores/quality.test.ts b/packages/core/src/common/util/scores/quality.test.ts index e5c71eea..3fc17e75 100644 --- a/packages/core/src/common/util/scores/quality.test.ts +++ b/packages/core/src/common/util/scores/quality.test.ts @@ -10,7 +10,7 @@ describe('displayQuality', () => { describe('displayQualityCI', () => { it('returns a 95% CI string from a negated value and std dev', () => { - expect(displayQualityCI(-2, 0.5)).toBe('[1.02, 2.98]') + expect(displayQualityCI(-2, 0.5)).toBe('[1.02 to 2.98]') }) it('returns an empty string when value or stdDev is missing/zero', () => { diff --git a/packages/core/src/common/util/scores/quality.ts b/packages/core/src/common/util/scores/quality.ts index 39fd684c..2c80cebf 100644 --- a/packages/core/src/common/util/scores/quality.ts +++ b/packages/core/src/common/util/scores/quality.ts @@ -8,7 +8,7 @@ export const displayQualityCI = (value: number, stdDev: number): string => { } const lower = -value - 1.96 * stdDev const upper = -value + 1.96 * stdDev - return `[${lower.toFixed(2)}, ${upper.toFixed(2)}]` + return `[${lower.toFixed(2)} to ${upper.toFixed(2)}]` } // Cost is stored as-is (not negated), so its 95% CI is value ± 1.96·σ with no @@ -19,5 +19,5 @@ export const displayCostCI = (value: number, stdDev: number): string => { } const lower = value - 1.96 * stdDev const upper = value + 1.96 * stdDev - return `[${lower.toFixed(2)}, ${upper.toFixed(2)}]` + return `[${lower.toFixed(2)} to ${upper.toFixed(2)}]` }