@bycelium/evidences-diagrams

中文文档
1.0.1发布于 2026/10/29Apache-2.0TypeScriptES Module零依赖

Evidence-weight aggregation and visualization in decibans.

此软件包已被标记为弃用

Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.

原始使用文档
文档目录6 节
  1. Demo walkthrough
  2. No evidence and the color legend
  3. Adding and combining evidence
  4. Conflicting evidence and prior bounds
  5. Model
  6. Install

@bycelium/evidences-diagrams

Combine evidence, measure dissonance, and explore how prior beliefs change the result.

Open the live demo · Download the standalone demo

Add evidence

Add evidence

Change the prior

Change the prior

Adjust evidence weights

Adjust evidence weights

The demo supports English and French, with editable categories and illustrative weights. The downloaded HTML works offline.

Demo walkthrough

No evidence and the color legend

Initial diagram with no evidence, a net weight of zero decibans, and a prior interval.

With no evidence, the result is none (0 dBan). The prior band is visible and the probability remains indeterminate. The color legend places dissonance at the top, evidence against at the left, evidence for at the right, and no evidence at the center.

Triangular color legend showing dissonance, evidence against, no evidence, and evidence for.

Adding and combining evidence

Evidence controls and one supporting news report with a weight of plus five decibans.

Choose a category, set its supporting or opposing weight, and add it to the history. Editing a category control updates its existing evidence entries of the same category and direction. The history supports selection and removal.

Gray result for weak supporting evidence that leaves the posterior interval across fifty percent.

Weak evidence can remain gray when the posterior interval crosses 50%.

Evidence forEvidence against
Green result for converging evidence for a claim.Red result for converging evidence against a claim.
+10 +10 +10 = +30 dBan−10 −10 −10 = −30 dBan

These walkthrough examples use adjusted weights. The resultant starts at the conservative prior endpoint and ends at the posterior odds used for the displayed probability.

Conflicting evidence and prior bounds

Evidence path for alternating supporting and opposing entries.

The ribbon retains the cumulative path, so opposing evidence remains visible.

Yellow result for completely dissonant evidence with zero net weight.

Yellow identifies dissonance: equal and opposing weights cancel in the net weight while remaining in the absolute weight.

Prior intervalExact prior
A positive evidence weight evaluated across a prior interval.The same positive evidence weight evaluated with an exact prior.

Move the prior handles or use the keyboard to change each bound. Equal bounds form an exact prior and expose one reusable handle.

Model

For independent signed evidence weights wᵢ, the package calculates:

  • S = Σ wᵢ, the net weight.
  • A = Σ |wᵢ|, the absolute weight.
  • D = 1 − |S| / A, the dissonance, with D = 0 when A = 0.

For example, +9 dBan and −1 dBan produce S = +8 dBan, A = 10 dBan, and D = 20%. Decibans are log odds: +10 dBan multiplies the odds by ten. For probability p:

d = 10 × log10(p / (1 − p))
p = 1 / (1 + 10^(−d / 10))

A prior interval [min, max] is expressed in decibans. Net evidence translates it to [min + S, max + S], then each endpoint is converted to probability. The conservative probability uses the lower endpoint for positive evidence and the upper endpoint for negative evidence. Equal bounds produce an exact probability.

Install

pnpm add @bycelium/evidences-diagrams
API reference
import {
  aggregateEvidence,
  buildEvidenceDiagram,
  boundProbability,
} from '@bycelium/evidences-diagrams';

const evidence = [
  { id: 'report', weightDecibans: 12 },
  { id: 'counter-analysis', weightDecibans: -5 },
];

const summary = aggregateEvidence(evidence);
summary.netWeightDecibans; // 7
summary.absoluteWeightDecibans; // 17
summary.dissonance; // 10 / 17

const diagram = buildEvidenceDiagram(evidence);
diagram.steps[1].end; // { netWeightDecibans: 7, absoluteWeightDecibans: 17 }
diagram.resultant.jeffreysBand; // 'moderate'
diagram.probability.text; // 'Probability ≥ 13 %'

boundProbability(summary).direction; // 'lower'
ExportPurpose
aggregateEvidence(weights)Returns net weight, absolute weight, and dissonance.
probabilityToDecibans({ probability })Converts probability to decibans.
decibansToProbability({ weightDecibans })Converts decibans to probability.
boundProbability(summary, options?)Returns a conservative, exact, or indeterminate probability.
buildEvidenceDiagram(evidence, options?)Returns a render-independent diagram model.
jeffreysBand({ weightDecibans })Returns none, anecdotal, moderate, strong, very strong, or decisive; negative nonzero bands end with against.
color, triangleColor, trianglePositionProvide diagram color and triangular-legend values.
DEFAULT_COLOR_OPTIONSProvides default color settings.

EvidenceWeight has weightDecibans. EvidenceSummary has netWeightDecibans, absoluteWeightDecibans, and dissonance. Probability has probability. ProbabilityBoundsOptions accepts minPriorDecibans and maxPriorDecibans. ColorOptions adds saturationThresholdDecibans and anchors.gray, anchors.yellow, anchors.green, and anchors.red.

Numeric ProbabilityBound values have direction (lower, upper, or exact), probability, displayPercentage, and English text. An indeterminate value has direction: 'indeterminate', a reason of 'no-evidence' or 'dissonant-evidence', and English text.

The default prior interval is [-15, +15] dBan. The diagram keeps raw decibans in its steps and resultant so a consumer can choose its own projection.

Development and localization
pnpm install
pnpm build:demo
pnpm check

build:demo bundles the demo into demo/index.html; check runs the project checks and consumer installation test. To add a locale, create a dictionary in demo/locales/ and register it in demo/i18n.js. To add a category, update demo/category-state.js and each locale dictionary.

Apache-2.0. See LICENSE and NOTICE.

版本与发布记录

@bycelium/evidences-diagrams 共发布 3 个版本,首次发布于 2026/10/28;过去 12 个月发布了 3 个版本。

版本发布日期距今
1.0.1latest2026/10/295 天前
1.0.02026/10/285 天前
0.0.0-stage2026/10/285 天前

关于 @bycelium/evidences-diagrams 的常见问题

@bycelium/evidences-diagrams 是什么?

证据权重聚集和可视化。注意:该包已被作者标记为弃用——Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.

如何安装 @bycelium/evidences-diagrams?

在项目目录运行 npm install @bycelium/evidences-diagrams,或使用 pnpm add / yarn add / bun add。

@bycelium/evidences-diagrams 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@bycelium/evidences-diagrams 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@bycelium/evidences-diagrams 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=24.3.0。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@bycelium/evidences-diagrams 可以商用吗?

@bycelium/evidences-diagrams 使用 Apache-2.0 许可。宽松许可:允许商业使用、修改和再分发,并附带明确的专利授权;分发时需保留许可与 NOTICE 文件,修改过的文件要注明改动。以上为概括,不构成法律意见,请以许可原文为准。

@bycelium/evidences-diagrams 还在维护吗?

最新版本 1.0.1 发布于 2026/10/29(5 天前);至今共发布 3 个版本,其中过去 12 个月发布了 3 个;首次发布于 2026/10/28。作者已将其标记为弃用,新项目建议寻找替代方案。