@mechane-ai/elements 0.46.0 → 0.47.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/README.md +306 -33
- package/dist/ai.js +4 -4
- package/dist/catalog.json +2382 -33
- package/dist/categorical-values-DdfGIowV.js +107 -0
- package/dist/cells--Bd1fQFR.js +384 -0
- package/dist/chart-link-AE_xuxiP.js +35 -0
- package/dist/chart-tones-ei3BC2AL.js +27 -0
- package/dist/charts/cartesian.js +1 -2958
- package/dist/charts/cells.js +1 -0
- package/dist/charts/comparison.js +1 -0
- package/dist/charts/distribution.js +1 -781
- package/dist/charts/figure.js +3404 -0
- package/dist/charts/graph.js +1 -655
- package/dist/charts/hierarchy.js +1 -121
- package/dist/charts/image.js +1 -0
- package/dist/charts/matrix.js +3 -644
- package/dist/charts/plot.js +15 -0
- package/dist/charts/relationship.js +1 -0
- package/dist/charts/text.js +1 -0
- package/dist/charts/timeline.js +1 -266
- package/dist/charts/transforms.js +677 -0
- package/dist/charts/trend.js +1 -0
- package/dist/charts.js +8 -3
- package/dist/collections.js +1 -2195
- package/dist/color-legend-CIo7DhXB.js +62 -0
- package/dist/dates-Cww8UR_n.js +810 -0
- package/dist/dumbbell-plot-B2ZTgQaI.js +508 -0
- package/dist/embedding-map-CGM_k6lC.js +1929 -0
- package/dist/feedback.js +1 -1
- package/dist/figure-format-B8kRZMlo.js +36 -0
- package/dist/figure-frame-wRkIEAwe.js +270 -0
- package/dist/forms/dates.js +1 -810
- package/dist/heatmap-scale-Zte6Ya-g.js +20 -0
- package/dist/image-grid-CVA4SOy_.js +598 -0
- package/dist/kits/evaluation.js +431 -0
- package/dist/kits/explainers.js +452 -0
- package/dist/kits/interpretability.js +1033 -0
- package/dist/kits/operations.js +239 -0
- package/dist/kits/training.js +335 -0
- package/dist/label-place-Z0fryBZb.js +42 -0
- package/dist/locate-Bcg3QcP4.js +11 -0
- package/dist/packages/charts/src/cartesian/bar-chart.d.ts +40 -21
- package/dist/packages/charts/src/cartesian/bar-data.d.ts +15 -4
- package/dist/packages/charts/src/cartesian/bar-overlays.d.ts +7 -3
- package/dist/packages/charts/src/cartesian/breakdown-bar.d.ts +10 -8
- package/dist/packages/charts/src/cartesian/bridge-chart.d.ts +20 -16
- package/dist/packages/charts/src/cartesian/bridge-data.d.ts +5 -4
- package/dist/packages/charts/src/cartesian/composition-bars.d.ts +8 -4
- package/dist/packages/charts/src/cartesian/index.d.ts +5 -5
- package/dist/packages/charts/src/cartesian/reference-lines.d.ts +25 -18
- package/dist/packages/charts/src/cartesian/scatter-plot.d.ts +30 -25
- package/dist/packages/charts/src/cartesian/sparkline.d.ts +14 -2
- package/dist/packages/charts/src/cartesian/time-series-bands.d.ts +3 -2
- package/dist/packages/charts/src/cartesian/time-series-data.d.ts +12 -2
- package/dist/packages/charts/src/cartesian/time-series-line.d.ts +2 -2
- package/dist/packages/charts/src/cartesian/time-series-overlays.d.ts +6 -4
- package/dist/packages/charts/src/cartesian/time-series.d.ts +60 -36
- package/dist/packages/charts/src/cartesian/value-labels.d.ts +22 -0
- package/dist/packages/charts/src/categorical-values.d.ts +1 -1
- package/dist/packages/charts/src/cells/bar-cell.d.ts +13 -0
- package/dist/packages/charts/src/cells/cell-layout.d.ts +81 -0
- package/dist/packages/charts/src/cells/change-cell.d.ts +17 -0
- package/dist/packages/charts/src/cells/heat-cell.d.ts +19 -0
- package/dist/packages/charts/src/cells/index.d.ts +11 -0
- package/dist/packages/charts/src/cells/interval-cell.d.ts +16 -0
- package/dist/packages/charts/src/cells/spark-cell.d.ts +22 -0
- package/dist/packages/charts/src/chart-frame.d.ts +14 -7
- package/dist/packages/charts/src/chart-grid.d.ts +19 -0
- package/dist/packages/charts/src/chart-input.d.ts +1 -9
- package/dist/packages/charts/src/chart-link.d.ts +56 -0
- package/dist/packages/charts/src/chart.d.ts +0 -8
- package/dist/packages/charts/src/comparison/bullet-bar.d.ts +34 -0
- package/dist/packages/charts/src/comparison/comparison-plot.d.ts +54 -0
- package/dist/packages/charts/src/comparison/dot-plot.d.ts +41 -0
- package/dist/packages/charts/src/comparison/dumbbell-plot.d.ts +33 -0
- package/dist/packages/charts/src/comparison/index.d.ts +6 -0
- package/dist/packages/charts/src/distribution/box-plot.d.ts +40 -0
- package/dist/packages/charts/src/distribution/distribution-input.d.ts +5 -3
- package/dist/packages/charts/src/distribution/distribution-plot.d.ts +28 -161
- package/dist/packages/charts/src/distribution/ecdf.d.ts +16 -15
- package/dist/packages/charts/src/distribution/group-plot-input.d.ts +35 -0
- package/dist/packages/charts/src/distribution/group-plot-layout.d.ts +79 -0
- package/dist/packages/charts/src/distribution/group-plot.d.ts +73 -0
- package/dist/packages/charts/src/distribution/histogram.d.ts +16 -16
- package/dist/packages/charts/src/distribution/index.d.ts +11 -0
- package/dist/packages/charts/src/distribution/interval-plot.d.ts +16 -13
- package/dist/packages/charts/src/distribution/ranked-bars.d.ts +17 -14
- package/dist/packages/charts/src/distribution/ridgeline.d.ts +34 -0
- package/dist/packages/charts/src/distribution/strip-plot.d.ts +37 -0
- package/dist/packages/charts/src/distribution/violin-plot.d.ts +34 -0
- package/dist/packages/charts/src/figure/figure-format.d.ts +34 -0
- package/dist/packages/charts/src/figure/figure-frame.d.ts +47 -0
- package/dist/packages/charts/src/figure/figure-props.d.ts +54 -0
- package/dist/packages/charts/src/figure/tone-scope.d.ts +32 -0
- package/dist/packages/charts/src/graph/attribution-graph.d.ts +62 -0
- package/dist/packages/charts/src/graph/attribution-layout.d.ts +88 -0
- package/dist/packages/charts/src/graph/flow-diagram.d.ts +14 -15
- package/dist/packages/charts/src/graph/flow-layout.d.ts +4 -2
- package/dist/packages/charts/src/graph/graph-canvas.d.ts +33 -0
- package/dist/packages/charts/src/graph/index.d.ts +6 -2
- package/dist/packages/charts/src/graph/relation-graph.d.ts +24 -13
- package/dist/packages/charts/src/graph/tree-diagram.d.ts +41 -0
- package/dist/packages/charts/src/graph/tree-layout.d.ts +71 -0
- package/dist/packages/charts/src/hierarchy/area-mark.d.ts +17 -0
- package/dist/packages/charts/src/hierarchy/icicle.d.ts +35 -0
- package/dist/packages/charts/src/hierarchy/index.d.ts +2 -0
- package/dist/packages/charts/src/hierarchy/partition-layout.d.ts +25 -0
- package/dist/packages/charts/src/hierarchy/treemap-layout.d.ts +26 -0
- package/dist/packages/charts/src/hierarchy/treemap.d.ts +11 -9
- package/dist/packages/charts/src/image/attribution-legend.d.ts +13 -0
- package/dist/packages/charts/src/image/attribution-overlay.d.ts +50 -0
- package/dist/packages/charts/src/image/attribution-ramp.d.ts +16 -0
- package/dist/packages/charts/src/image/image-atlas.d.ts +37 -0
- package/dist/packages/charts/src/image/image-fill.d.ts +9 -0
- package/dist/packages/charts/src/image/image-grid.d.ts +26 -0
- package/dist/packages/charts/src/image/image-input.d.ts +27 -0
- package/dist/packages/charts/src/image/image-tile.d.ts +27 -0
- package/dist/packages/charts/src/image/index.d.ts +7 -0
- package/dist/packages/charts/src/index.d.ts +15 -1
- package/dist/packages/charts/src/matrix/attention-matrix.d.ts +41 -0
- package/dist/packages/charts/src/matrix/calendar-heatmap.d.ts +37 -0
- package/dist/packages/charts/src/matrix/color-legend.d.ts +9 -2
- package/dist/packages/charts/src/matrix/confusion-matrix.d.ts +36 -0
- package/dist/packages/charts/src/matrix/correlation-matrix.d.ts +34 -0
- package/dist/packages/charts/src/matrix/heatmap-scale.d.ts +8 -2
- package/dist/packages/charts/src/matrix/index.d.ts +14 -3
- package/dist/packages/charts/src/matrix/matrix-cells.d.ts +27 -3
- package/dist/packages/charts/src/matrix/matrix-figure.d.ts +50 -0
- package/dist/packages/charts/src/matrix/matrix-mark.d.ts +34 -0
- package/dist/packages/charts/src/matrix/matrix-presets.d.ts +20 -0
- package/dist/packages/charts/src/matrix/matrix-range.d.ts +45 -0
- package/dist/packages/charts/src/matrix/matrix-strip.d.ts +13 -14
- package/dist/packages/charts/src/matrix/matrix-types.d.ts +40 -0
- package/dist/packages/charts/src/matrix/matrix.d.ts +13 -11
- package/dist/packages/charts/src/matrix/token-heatmap.d.ts +16 -10
- package/dist/packages/charts/src/plot/contours.d.ts +45 -0
- package/dist/packages/charts/src/plot/index.d.ts +49 -0
- package/dist/packages/charts/src/plot/label-place.d.ts +35 -0
- package/dist/packages/charts/src/plot/locate.d.ts +18 -0
- package/dist/packages/charts/src/plot/path.d.ts +39 -0
- package/dist/packages/charts/src/plot/plot-axes.d.ts +20 -0
- package/dist/packages/charts/src/plot/plot-layout.d.ts +221 -0
- package/dist/packages/charts/src/plot/plot-marks.d.ts +124 -0
- package/dist/packages/charts/src/plot/plot-surface.d.ts +32 -0
- package/dist/packages/charts/src/plot/render/density-layer.d.ts +17 -0
- package/dist/packages/charts/src/plot/render/hit-index.d.ts +37 -0
- package/dist/packages/charts/src/plot/render/plot-viewport.d.ts +39 -0
- package/dist/packages/charts/src/plot/render/point-layer.d.ts +41 -0
- package/dist/packages/charts/src/plot/render/theme-colors.d.ts +15 -0
- package/dist/packages/charts/src/plot/scale.d.ts +48 -0
- package/dist/packages/charts/src/plot/ticks.d.ts +34 -0
- package/dist/packages/charts/src/plot-width.d.ts +3 -2
- package/dist/packages/charts/src/relationship/contour-plot.d.ts +61 -0
- package/dist/packages/charts/src/relationship/density-map.d.ts +45 -0
- package/dist/packages/charts/src/relationship/embedding-map.d.ts +75 -0
- package/dist/packages/charts/src/relationship/index.d.ts +11 -0
- package/dist/packages/charts/src/relationship/level-legend.d.ts +11 -0
- package/dist/packages/charts/src/relationship/measures.d.ts +85 -0
- package/dist/packages/charts/src/relationship/parallel-coordinates.d.ts +30 -0
- package/dist/packages/charts/src/relationship/range-controls.d.ts +20 -0
- package/dist/packages/charts/src/relationship/scatter-matrix.d.ts +20 -0
- package/dist/packages/charts/src/spec/chart-guide.d.ts +21 -0
- package/dist/packages/charts/src/spec/figure-registry.d.ts +44 -0
- package/dist/packages/charts/src/spec/figure-spec.d.ts +147 -0
- package/dist/packages/charts/src/spec/figure-text.d.ts +8 -0
- package/dist/packages/charts/src/spec/figure.d.ts +12 -0
- package/dist/packages/charts/src/spec/guide-data.d.ts +85 -0
- package/dist/packages/charts/src/spec/index.d.ts +10 -0
- package/dist/packages/charts/src/spec/validate-figure.d.ts +15 -0
- package/dist/packages/charts/src/text/index.d.ts +11 -0
- package/dist/packages/charts/src/text/token-examples.d.ts +42 -0
- package/dist/packages/charts/src/text/token-grid.d.ts +47 -0
- package/dist/packages/charts/src/text/token-links.d.ts +49 -0
- package/dist/packages/charts/src/text/token-predictions.d.ts +38 -0
- package/dist/packages/charts/src/text/token-scale.d.ts +20 -0
- package/dist/packages/charts/src/text/token-text.d.ts +39 -0
- package/dist/packages/charts/src/timeline/event-strip.d.ts +70 -0
- package/dist/packages/charts/src/timeline/index.d.ts +3 -1
- package/dist/packages/charts/src/timeline/waterfall.d.ts +24 -13
- package/dist/packages/charts/src/transforms/bins.d.ts +91 -0
- package/dist/packages/charts/src/transforms/density.d.ts +53 -0
- package/dist/packages/charts/src/transforms/fits.d.ts +50 -0
- package/dist/packages/charts/src/transforms/index.d.ts +19 -0
- package/dist/packages/charts/src/transforms/matrices.d.ts +49 -0
- package/dist/packages/charts/src/transforms/quantiles.d.ts +96 -0
- package/dist/packages/charts/src/transforms/ranks.d.ts +44 -0
- package/dist/packages/charts/src/transforms/runs.d.ts +47 -0
- package/dist/packages/charts/src/transforms/sampling.d.ts +75 -0
- package/dist/packages/charts/src/transforms/smoothing.d.ts +41 -0
- package/dist/packages/charts/src/transforms/values.d.ts +70 -0
- package/dist/packages/charts/src/trend/bump-chart.d.ts +33 -0
- package/dist/packages/charts/src/trend/column-figure.d.ts +38 -0
- package/dist/packages/charts/src/trend/column-positions.d.ts +21 -0
- package/dist/packages/charts/src/trend/curve-chart.d.ts +69 -0
- package/dist/packages/charts/src/trend/end-labels.d.ts +40 -0
- package/dist/packages/charts/src/trend/horizon-chart.d.ts +37 -0
- package/dist/packages/charts/src/trend/index.d.ts +10 -0
- package/dist/packages/charts/src/trend/line-locate.d.ts +21 -0
- package/dist/packages/charts/src/trend/runs-chart.d.ts +50 -0
- package/dist/packages/charts/src/trend/slope-chart.d.ts +35 -0
- package/dist/packages/kits/src/evaluation/evaluation-data.d.ts +31 -0
- package/dist/packages/kits/src/evaluation/index.d.ts +8 -0
- package/dist/packages/kits/src/evaluation/leaderboard-cells.d.ts +62 -0
- package/dist/packages/kits/src/evaluation/leaderboard.d.ts +59 -0
- package/dist/packages/kits/src/evaluation/model-comparison.d.ts +59 -0
- package/dist/packages/kits/src/evaluation/score-breakdown.d.ts +33 -0
- package/dist/packages/kits/src/explainers/bound-value.d.ts +29 -0
- package/dist/packages/kits/src/explainers/figures.d.ts +31 -0
- package/dist/packages/kits/src/explainers/index.d.ts +8 -0
- package/dist/packages/kits/src/explainers/linked-target.d.ts +22 -0
- package/dist/packages/kits/src/explainers/story-steps.d.ts +46 -0
- package/dist/packages/kits/src/explainers/term.d.ts +29 -0
- package/dist/packages/kits/src/interpretability/attention-head-grid.d.ts +56 -0
- package/dist/packages/kits/src/interpretability/attribution-workbench.d.ts +29 -0
- package/dist/packages/kits/src/interpretability/embedding-atlas.d.ts +41 -0
- package/dist/packages/kits/src/interpretability/feature-card.d.ts +33 -0
- package/dist/packages/kits/src/interpretability/feature-list.d.ts +51 -0
- package/dist/packages/kits/src/interpretability/feature-logits.d.ts +23 -0
- package/dist/packages/kits/src/interpretability/features.d.ts +70 -0
- package/dist/packages/kits/src/interpretability/index.d.ts +16 -0
- package/dist/packages/kits/src/interpretability/kit-styles.d.ts +118 -0
- package/dist/packages/kits/src/interpretability/logit-lens.d.ts +50 -0
- package/dist/packages/kits/src/interpretability/node-panel.d.ts +32 -0
- package/dist/packages/kits/src/interpretability/shared-link.d.ts +8 -0
- package/dist/packages/kits/src/interpretability/steering-panel.d.ts +52 -0
- package/dist/packages/kits/src/operations/budget-board.d.ts +49 -0
- package/dist/packages/kits/src/operations/incident-timeline.d.ts +30 -0
- package/dist/packages/kits/src/operations/index.d.ts +6 -0
- package/dist/packages/kits/src/operations/service-health.d.ts +66 -0
- package/dist/packages/kits/src/training/index.d.ts +8 -0
- package/dist/packages/kits/src/training/run-dashboard.d.ts +49 -0
- package/dist/packages/kits/src/training/run-legend.d.ts +21 -0
- package/dist/packages/kits/src/training/run-marker.d.ts +5 -0
- package/dist/packages/kits/src/training/run-state.d.ts +7 -0
- package/dist/packages/kits/src/training/run-table.d.ts +63 -0
- package/dist/packages/kits/src/training/runs-overview.d.ts +20 -0
- package/dist/packages/kits/src/training/runs.d.ts +34 -0
- package/dist/path-BglsXpnO.js +59 -0
- package/dist/plot-axes-DJkLW4wk.js +100 -0
- package/dist/plot-layout-BEuoOHbs.js +911 -0
- package/dist/plot-marks-A64v7aTw.js +226 -0
- package/dist/plot-surface-CJTIqtck.js +51 -0
- package/dist/plot-width-DcqtSgzb.js +124 -0
- package/dist/point-layer-C-EYETAt.js +655 -0
- package/dist/reference-lines-CWA8VeUR.js +82 -0
- package/dist/scale-C2xgZyZN.js +63 -0
- package/dist/slope-chart-DT22h_ym.js +1279 -0
- package/dist/{src-DVHlknB6.js → src-CExIrXPC.js} +169 -193
- package/dist/src-D5NXRJZe.js +2195 -0
- package/dist/src-DIS0YOj0.js +44 -0
- package/dist/styles2.css +453 -62
- package/dist/time-series-IB3CB93O.js +2668 -0
- package/dist/token-heatmap-C00DnoNO.js +1354 -0
- package/dist/token-predictions-Cxx29iDr.js +1093 -0
- package/dist/tone-scope-DKiSw-JR.js +32 -0
- package/dist/tree-diagram-DsckNKaW.js +1629 -0
- package/dist/treemap-9_DpLCW9.js +472 -0
- package/dist/values-963L6n1m.js +65 -0
- package/dist/violin-plot-BhPHKXsN.js +1291 -0
- package/dist/waterfall-CGksuTy5.js +576 -0
- package/package.json +57 -4
- package/recipes/allocation-report.tsx +15 -7
- package/skills/extend-elements/SKILL.md +60 -0
- package/skills/review-elements/SKILL.md +43 -1
- package/skills/upgrade-elements/SKILL.md +3 -1
- package/skills/upgrade-elements/references/releases.md +184 -0
- package/skills/use-elements/SKILL.md +19 -13
- package/skills/use-elements/references/charts.md +362 -41
- package/skills/use-elements/references/figures.md +173 -0
- package/skills/use-elements/references/kits.md +198 -0
- package/dist/categorical-values-BXi-rJuv.js +0 -74
- package/dist/chart-data-CIJVWCYt.js +0 -21
- package/dist/chart-frame-BaxKn_MB.js +0 -236
- package/dist/chart-input-Bm82_9Rd.js +0 -22
- package/dist/chart-theme-4zprJ3rW.js +0 -404
- package/dist/plot-width-v2c_rA20.js +0 -63
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import type { WaterfallProps as SpansProps } from '@ui-sdk/react/waterfall';
|
|
2
2
|
import type { ReactNode, Ref } from 'react';
|
|
3
|
-
import type {
|
|
4
|
-
type
|
|
3
|
+
import type { ChartTone } from '../../../foundations/src/chart-tones.ts';
|
|
4
|
+
import type { ValueFormat } from '../figure/figure-format.ts';
|
|
5
|
+
import type { FigureProps } from '../figure/figure-props.ts';
|
|
6
|
+
/** A row's timing: two recorded endpoints, one recorded instant, or none. Nothing is drawn from a missing endpoint. */
|
|
7
|
+
export type WaterfallGeometry = {
|
|
5
8
|
readonly kind: 'interval';
|
|
6
9
|
readonly start: number;
|
|
7
10
|
readonly end: number;
|
|
@@ -12,31 +15,39 @@ type WaterfallGeometry = {
|
|
|
12
15
|
} | {
|
|
13
16
|
readonly kind: 'unavailable';
|
|
14
17
|
};
|
|
18
|
+
/** The tones a waterfall row takes: neutral evidence, a success, or a failure. */
|
|
19
|
+
export type WaterfallTone = Extract<ChartTone, 'neutral' | 'positive' | 'negative'>;
|
|
20
|
+
/** One timed row. Rows keep the supplied order and share one scale. */
|
|
15
21
|
export type WaterfallItem = {
|
|
16
22
|
readonly id: string;
|
|
17
23
|
readonly label: string;
|
|
18
24
|
readonly detail: string;
|
|
19
25
|
readonly summary: string;
|
|
20
|
-
|
|
26
|
+
/** Neutral when left out. */
|
|
27
|
+
readonly tone?: WaterfallTone | undefined;
|
|
21
28
|
readonly geometry: WaterfallGeometry;
|
|
22
|
-
|
|
29
|
+
/** The id of the region this row updates when selected, exposed as `aria-controls`. */
|
|
30
|
+
readonly controls?: string | undefined;
|
|
23
31
|
};
|
|
24
32
|
/** Why the selection wants to change: a press or Enter on a row, or a call such as an agent's step. */
|
|
25
33
|
export type WaterfallSelectDetails = Parameters<NonNullable<SpansProps['onValueChange']>>[1];
|
|
26
|
-
type WaterfallProps = {
|
|
34
|
+
export type WaterfallProps = Pick<FigureProps, 'title' | 'description' | 'report' | 'actions' | 'locale' | 'source' | 'transforms' | 'emptyLabel'> & {
|
|
27
35
|
readonly items: ReadonlyArray<WaterfallItem>;
|
|
36
|
+
/** The time domain every row shares, in the unit of `offsetFormat`. */
|
|
28
37
|
readonly start: number;
|
|
29
38
|
readonly end: number;
|
|
30
|
-
readonly label: string;
|
|
31
|
-
readonly report?: ChartReport | undefined;
|
|
32
39
|
readonly rowLabel: string;
|
|
33
40
|
readonly summaryLabel: string;
|
|
34
|
-
readonly
|
|
35
|
-
readonly selectedId: string | undefined;
|
|
41
|
+
readonly selected?: string | null | undefined;
|
|
36
42
|
/** The selected row, which takes focus, so an owner can return focus to it. */
|
|
37
43
|
readonly selectedRef?: Ref<HTMLDivElement> | undefined;
|
|
38
|
-
readonly
|
|
39
|
-
|
|
44
|
+
readonly onSelectedChange: (id: string, details: WaterfallSelectDetails) => void;
|
|
45
|
+
/** How a time from the start of the domain is written, with its unit. */
|
|
46
|
+
readonly offsetFormat: ValueFormat;
|
|
40
47
|
};
|
|
41
|
-
|
|
42
|
-
|
|
48
|
+
/**
|
|
49
|
+
* Recorded intervals and instants of many rows on one time scale, such as the steps of a request or a run. Each row
|
|
50
|
+
* states its exact timing as text, a row without timing says so, and the rows are one Tab stop the application selects
|
|
51
|
+
* from.
|
|
52
|
+
*/
|
|
53
|
+
export declare function Waterfall({ items, start, end, rowLabel, summaryLabel, emptyLabel, selected, selectedRef, onSelectedChange, offsetFormat, ...frame }: WaterfallProps): ReactNode;
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import type { NumericDomain } from '../plot/scale.ts';
|
|
2
|
+
import type { TransformOk, TransformResult } from './values.ts';
|
|
3
|
+
/** The most bins, columns or rows a binning transform makes. */
|
|
4
|
+
export declare const binLimits: {
|
|
5
|
+
readonly bins: 1000;
|
|
6
|
+
readonly cells: 1000;
|
|
7
|
+
};
|
|
8
|
+
/** One interval of a histogram and how many values fell in it. */
|
|
9
|
+
export type ValueBin = {
|
|
10
|
+
readonly id: string;
|
|
11
|
+
/** The interval as a reader sees it: "10–20". */
|
|
12
|
+
readonly label: string;
|
|
13
|
+
readonly lowerBound: number;
|
|
14
|
+
readonly upperBound: number;
|
|
15
|
+
readonly count: number;
|
|
16
|
+
};
|
|
17
|
+
export type BinValuesInput = {
|
|
18
|
+
readonly values: ReadonlyArray<number | null>;
|
|
19
|
+
/**
|
|
20
|
+
* The outer edges, split exactly into bins. Leave it out to cover the values on round edges: multiples of 1, 2 or 5
|
|
21
|
+
* times a power of ten.
|
|
22
|
+
*/
|
|
23
|
+
readonly domain?: NumericDomain | undefined;
|
|
24
|
+
/** The locale and number format the bin labels use. */
|
|
25
|
+
readonly locale: string;
|
|
26
|
+
readonly format?: Intl.NumberFormatOptions | undefined;
|
|
27
|
+
} & ({
|
|
28
|
+
/** About this many bins when the edges are round. */
|
|
29
|
+
readonly binCount: number;
|
|
30
|
+
readonly binWidth?: undefined;
|
|
31
|
+
} | {
|
|
32
|
+
/** Bins this wide when the edges are round. */
|
|
33
|
+
readonly binWidth: number;
|
|
34
|
+
readonly binCount?: undefined;
|
|
35
|
+
});
|
|
36
|
+
export type BinValuesResult = TransformResult<{
|
|
37
|
+
readonly bins: ReadonlyArray<ValueBin>;
|
|
38
|
+
readonly binWidth: number;
|
|
39
|
+
readonly domain: NumericDomain;
|
|
40
|
+
/** Values that were missing (null, NaN or infinite). */
|
|
41
|
+
readonly skipped: number;
|
|
42
|
+
/** Values outside a supplied domain. */
|
|
43
|
+
readonly outside: number;
|
|
44
|
+
}>;
|
|
45
|
+
/**
|
|
46
|
+
* Count values in equal intervals for a histogram, skipping and counting missing values (null, NaN, infinite) and never
|
|
47
|
+
* reading them as zero. Each bin holds its lower edge, and the last bin also holds its upper edge. Values outside a
|
|
48
|
+
* supplied domain are left out and counted.
|
|
49
|
+
*/
|
|
50
|
+
export declare function binValues(input: BinValuesInput): BinValuesResult;
|
|
51
|
+
/**
|
|
52
|
+
* The footnote for `binValues`: how many bins, how wide, and what was left out, as in "Counted in 20 bins of width
|
|
53
|
+
* 0.5."
|
|
54
|
+
*/
|
|
55
|
+
export declare function describeBins({ result, locale, }: {
|
|
56
|
+
readonly result: TransformOk<BinValuesResult>;
|
|
57
|
+
readonly locale: string;
|
|
58
|
+
}): string;
|
|
59
|
+
export type Bin2dInput = {
|
|
60
|
+
/** The horizontal positions; a point is `x[i]`, `y[i]`. */
|
|
61
|
+
readonly x: ReadonlyArray<number | null>;
|
|
62
|
+
readonly y: ReadonlyArray<number | null>;
|
|
63
|
+
readonly columns: number;
|
|
64
|
+
readonly rows: number;
|
|
65
|
+
/** The horizontal extent. Without a domain, each axis covers its points on round edges. */
|
|
66
|
+
readonly xDomain?: NumericDomain | undefined;
|
|
67
|
+
readonly yDomain?: NumericDomain | undefined;
|
|
68
|
+
};
|
|
69
|
+
export type Bin2dResult = TransformResult<{
|
|
70
|
+
readonly columns: number;
|
|
71
|
+
readonly rows: number;
|
|
72
|
+
/** One count per cell, row by row. Row 0 holds the lowest y and column 0 the lowest x, as `DensityMap` reads. */
|
|
73
|
+
readonly counts: ReadonlyArray<number>;
|
|
74
|
+
readonly xDomain: NumericDomain;
|
|
75
|
+
readonly yDomain: NumericDomain;
|
|
76
|
+
/** Points with a missing x or y. */
|
|
77
|
+
readonly skipped: number;
|
|
78
|
+
/** Points outside a supplied domain. */
|
|
79
|
+
readonly outside: number;
|
|
80
|
+
}>;
|
|
81
|
+
/**
|
|
82
|
+
* Count points in a grid of equal cells for a density map: `columns` across the x domain and `rows` up the y domain.
|
|
83
|
+
* Cells hold their lower edges, and the last column and the top row also hold their upper edges. A point with a missing
|
|
84
|
+
* x or y is skipped and counted, and a point outside a supplied domain is left out and counted.
|
|
85
|
+
*/
|
|
86
|
+
export declare function bin2d({ x, y, columns, rows, xDomain, yDomain }: Bin2dInput): Bin2dResult;
|
|
87
|
+
/** The footnote for `bin2d`: the grid size and what was left out, as in "Counted in a 40 × 30 grid." */
|
|
88
|
+
export declare function describeBin2d({ result, locale, }: {
|
|
89
|
+
readonly result: TransformOk<Bin2dResult>;
|
|
90
|
+
readonly locale: string;
|
|
91
|
+
}): string;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import type { NumericDomain } from '../plot/scale.ts';
|
|
2
|
+
import type { TransformOk, TransformResult } from './values.ts';
|
|
3
|
+
/** The number of points and values a density estimate accepts. */
|
|
4
|
+
export declare const densityLimits: {
|
|
5
|
+
readonly pointsDefault: 128;
|
|
6
|
+
readonly pointsMin: 2;
|
|
7
|
+
readonly pointsMax: 2000;
|
|
8
|
+
};
|
|
9
|
+
/** One point of a density curve. */
|
|
10
|
+
export type DensityPoint = {
|
|
11
|
+
readonly value: number;
|
|
12
|
+
/** The estimated share of values per unit of `value` near this point. */
|
|
13
|
+
readonly density: number;
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* Silverman's rule of thumb for the width of a Gaussian kernel: 0.9 × min(standard deviation, IQR / 1.34) × n^(−1/5).
|
|
17
|
+
* It suits roughly bell-shaped data and oversmooths several peaks. Missing values are skipped, and it returns null for
|
|
18
|
+
* fewer than two values or values that do not vary.
|
|
19
|
+
*/
|
|
20
|
+
export declare function silvermanBandwidth(values: ReadonlyArray<number | null>): number | null;
|
|
21
|
+
export type KernelDensityInput = {
|
|
22
|
+
readonly values: ReadonlyArray<number | null>;
|
|
23
|
+
/** How many evenly spaced points the curve has. Defaults to 128. */
|
|
24
|
+
readonly points?: number | undefined;
|
|
25
|
+
/** The kernel's standard deviation, in the values' unit. Leave it out to use Silverman's rule of thumb. */
|
|
26
|
+
readonly bandwidth?: number | undefined;
|
|
27
|
+
/** Where the curve is evaluated. Leave it out to reach three bandwidths past the smallest and largest value. */
|
|
28
|
+
readonly domain?: NumericDomain | undefined;
|
|
29
|
+
};
|
|
30
|
+
export type KernelDensityResult = TransformResult<{
|
|
31
|
+
readonly curve: ReadonlyArray<DensityPoint>;
|
|
32
|
+
readonly bandwidth: number;
|
|
33
|
+
/** True when the bandwidth came from Silverman's rule rather than the caller. */
|
|
34
|
+
readonly isRuleOfThumb: boolean;
|
|
35
|
+
readonly count: number;
|
|
36
|
+
/** Values that were missing (null, NaN or infinite). */
|
|
37
|
+
readonly skipped: number;
|
|
38
|
+
}>;
|
|
39
|
+
/**
|
|
40
|
+
* A smooth estimate of how values are distributed, for violin and ridgeline plots. Every value contributes a small bell
|
|
41
|
+
* curve (a Gaussian kernel) of width `bandwidth`, and the curve is their average, so its area is 1 over a domain
|
|
42
|
+
* covering the data. Without a bandwidth it uses Silverman's rule of thumb, and missing values are skipped and
|
|
43
|
+
* counted.
|
|
44
|
+
*/
|
|
45
|
+
export declare function kernelDensity({ values, points, bandwidth, domain, }: KernelDensityInput): KernelDensityResult;
|
|
46
|
+
/**
|
|
47
|
+
* The footnote for `kernelDensity`: the kernel, the bandwidth and where it came from, as in "Gaussian kernel density,
|
|
48
|
+
* bandwidth 0.42 (Silverman's rule)."
|
|
49
|
+
*/
|
|
50
|
+
export declare function describeKernelDensity({ result, locale, }: {
|
|
51
|
+
readonly result: TransformOk<KernelDensityResult>;
|
|
52
|
+
readonly locale: string;
|
|
53
|
+
}): string;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import type { ObservedPoint, SeriesPoint, TransformOk, TransformResult } from './values.ts';
|
|
2
|
+
type LeastSquares = {
|
|
3
|
+
readonly slope: number;
|
|
4
|
+
readonly intercept: number;
|
|
5
|
+
/** The share of the variation in y the line explains; null when y does not vary. */
|
|
6
|
+
readonly rSquared: number | null;
|
|
7
|
+
};
|
|
8
|
+
export type LinearFitResult = TransformResult<LeastSquares & {
|
|
9
|
+
/** The line at each distinct observed x, from smallest to largest: a series a chart can draw dashed. */
|
|
10
|
+
readonly fitted: ReadonlyArray<ObservedPoint>;
|
|
11
|
+
/** How many points the fit used. */
|
|
12
|
+
readonly count: number;
|
|
13
|
+
/** Points with a missing x or y. */
|
|
14
|
+
readonly skipped: number;
|
|
15
|
+
}>;
|
|
16
|
+
/**
|
|
17
|
+
* The straight line y = slope × x + intercept that minimizes the sum of squared vertical distances from the points to
|
|
18
|
+
* the line, by ordinary least squares. The r² value is the share of the variation in y that the line explains (1 is a
|
|
19
|
+
* perfect fit). Points with a missing x or y are skipped and counted.
|
|
20
|
+
*/
|
|
21
|
+
export declare function linearFit(points: ReadonlyArray<SeriesPoint>): LinearFitResult;
|
|
22
|
+
/** The footnote for `linearFit`, as in "Least-squares line, slope 0.42, r² 0.97." */
|
|
23
|
+
export declare function describeLinearFit({ result, locale, }: {
|
|
24
|
+
readonly result: TransformOk<LinearFitResult>;
|
|
25
|
+
readonly locale: string;
|
|
26
|
+
}): string;
|
|
27
|
+
export type PowerLawFitResult = TransformResult<{
|
|
28
|
+
readonly exponent: number;
|
|
29
|
+
readonly coefficient: number;
|
|
30
|
+
/** r² of the straight-line fit in log-log space. */
|
|
31
|
+
readonly rSquared: number | null;
|
|
32
|
+
/** The curve at each distinct observed x, from smallest to largest. */
|
|
33
|
+
readonly fitted: ReadonlyArray<ObservedPoint>;
|
|
34
|
+
readonly count: number;
|
|
35
|
+
/** Points with a missing x or y. */
|
|
36
|
+
readonly skipped: number;
|
|
37
|
+
}>;
|
|
38
|
+
/**
|
|
39
|
+
* The power law y = coefficient × x^exponent that best follows the points, as in scaling-law plots. Taking logarithms
|
|
40
|
+
* turns it into the line log y = log coefficient + exponent × log x, fitted by least squares, with r² of that line in
|
|
41
|
+
* log-log space. Logarithms need positive numbers, so any x or y at or below zero is rejected, and points with a
|
|
42
|
+
* missing x or y are skipped and counted.
|
|
43
|
+
*/
|
|
44
|
+
export declare function powerLawFit(points: ReadonlyArray<SeriesPoint>): PowerLawFitResult;
|
|
45
|
+
/** The footnote for `powerLawFit`, as in "Power-law fit by least squares in log-log space, exponent −0.11." */
|
|
46
|
+
export declare function describePowerLawFit({ result, locale, }: {
|
|
47
|
+
readonly result: TransformOk<PowerLawFitResult>;
|
|
48
|
+
readonly locale: string;
|
|
49
|
+
}): string;
|
|
50
|
+
export {};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export type { Bin2dInput, Bin2dResult, BinValuesInput, BinValuesResult, ValueBin } from './bins.ts';
|
|
2
|
+
export { bin2d, binLimits, binValues, describeBin2d, describeBins } from './bins.ts';
|
|
3
|
+
export type { DensityPoint, KernelDensityInput, KernelDensityResult } from './density.ts';
|
|
4
|
+
export { densityLimits, describeKernelDensity, kernelDensity, silvermanBandwidth } from './density.ts';
|
|
5
|
+
export type { LinearFitResult, PowerLawFitResult } from './fits.ts';
|
|
6
|
+
export { describeLinearFit, describePowerLawFit, linearFit, powerLawFit } from './fits.ts';
|
|
7
|
+
export type { ConfusionCountsResult, CorrelationMatrixResult } from './matrices.ts';
|
|
8
|
+
export { confusionCounts, correlationMatrix, describeConfusion, describeCorrelation } from './matrices.ts';
|
|
9
|
+
export type { BoxSummary, BoxSummaryResult, EcdfPoint, EcdfResult, FiveNumberResult, FiveNumberSummary, WhiskerRule, } from './quantiles.ts';
|
|
10
|
+
export { boxSummary, describeBoxSummary, describeEcdf, ecdfPoints, fiveNumberSummary, quantile } from './quantiles.ts';
|
|
11
|
+
export type { RankedItem, RankOrder, RankSeriesResult, StageRank } from './ranks.ts';
|
|
12
|
+
export { describeRanks, rankSeries } from './ranks.ts';
|
|
13
|
+
export type { RunSeries, RunSummaryPoint, SummarizeRunsInput, SummarizeRunsResult } from './runs.ts';
|
|
14
|
+
export { describeRunSummary, summarizeRuns } from './runs.ts';
|
|
15
|
+
export type { DownsampleResult, SampleResult } from './sampling.ts';
|
|
16
|
+
export { describeDownsample, describeSample, downsample, reservoirIndices, sampleEvenly, seededUniforms, } from './sampling.ts';
|
|
17
|
+
export type { ExponentialSmoothingResult, MovingAverageResult } from './smoothing.ts';
|
|
18
|
+
export { describeExponentialSmoothing, describeMovingAverage, exponentialSmoothing, movingAverage, } from './smoothing.ts';
|
|
19
|
+
export type { ObservedPoint, SeriesPoint, TransformInvalid, TransformOk, TransformResult } from './values.ts';
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import type { MatrixCell } from '../matrix/matrix-types.ts';
|
|
2
|
+
import type { TransformOk, TransformResult } from './values.ts';
|
|
3
|
+
export type CorrelationMatrixResult = TransformResult<{
|
|
4
|
+
/** One cell per pair of columns, row by row: cells a `Matrix` takes as they are. */
|
|
5
|
+
readonly cells: ReadonlyArray<MatrixCell>;
|
|
6
|
+
readonly columnCount: number;
|
|
7
|
+
readonly rowCount: number;
|
|
8
|
+
}>;
|
|
9
|
+
/**
|
|
10
|
+
* Pearson correlation coefficients between every pair of columns, from −1 (one falls as the other rises) through 0 (no
|
|
11
|
+
* straight-line relation) to 1 (they rise together). Each pair uses the rows where both columns have a value
|
|
12
|
+
* (pairwise-complete observations), so a missing value drops its row from its pairs and is never read as zero. A pair
|
|
13
|
+
* with fewer than two shared rows, or a column that does not vary, gives a missing cell with the reason.
|
|
14
|
+
*/
|
|
15
|
+
export declare function correlationMatrix({ columns, }: {
|
|
16
|
+
/** Each column's values by row, keyed by the column id; every column has the same rows in the same order. */
|
|
17
|
+
readonly columns: Readonly<Record<string, ReadonlyArray<number | null>>>;
|
|
18
|
+
}): CorrelationMatrixResult;
|
|
19
|
+
/**
|
|
20
|
+
* The footnote for `correlationMatrix`, as in "Pearson correlation of 8 columns over 500 rows, pairwise-complete
|
|
21
|
+
* observations."
|
|
22
|
+
*/
|
|
23
|
+
export declare function describeCorrelation({ result, locale, }: {
|
|
24
|
+
readonly result: TransformOk<CorrelationMatrixResult>;
|
|
25
|
+
readonly locale: string;
|
|
26
|
+
}): string;
|
|
27
|
+
export type ConfusionCountsResult = TransformResult<{
|
|
28
|
+
readonly cells: ReadonlyArray<MatrixCell>;
|
|
29
|
+
/** Examples with both an actual and a predicted class. */
|
|
30
|
+
readonly counted: number;
|
|
31
|
+
/** Examples missing either class. */
|
|
32
|
+
readonly skipped: number;
|
|
33
|
+
}>;
|
|
34
|
+
/**
|
|
35
|
+
* A confusion matrix: how many examples of each actual class (rows) received each predicted class (columns), in the
|
|
36
|
+
* order of `classes`. The diagonal holds the correct predictions. An example whose actual or predicted class is null is
|
|
37
|
+
* skipped and counted, and a class not in `classes` is rejected.
|
|
38
|
+
*/
|
|
39
|
+
export declare function confusionCounts({ actual, predicted, classes, }: {
|
|
40
|
+
readonly actual: ReadonlyArray<string | null>;
|
|
41
|
+
readonly predicted: ReadonlyArray<string | null>;
|
|
42
|
+
/** The class ids, in the order rows and columns appear. */
|
|
43
|
+
readonly classes: ReadonlyArray<string>;
|
|
44
|
+
}): ConfusionCountsResult;
|
|
45
|
+
/** The footnote for `confusionCounts`, as in "Counts of 1,000 examples by actual and predicted class." */
|
|
46
|
+
export declare function describeConfusion({ result, locale, }: {
|
|
47
|
+
readonly result: TransformOk<ConfusionCountsResult>;
|
|
48
|
+
readonly locale: string;
|
|
49
|
+
}): string;
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import type { TransformOk, TransformResult } from './values.ts';
|
|
2
|
+
/** The value a fraction `p` of the way through values already sorted from smallest to largest (type 7). */
|
|
3
|
+
export declare function sortedQuantile(sorted: ReadonlyArray<number>, probability: number): number | null;
|
|
4
|
+
/**
|
|
5
|
+
* The quantile of Hyndman and Fan type 7, the default of R, NumPy and spreadsheets: the value below which a fraction
|
|
6
|
+
* `p` of the values lie. The median is `quantile(values, 0.5)`, read from the sorted values at position (n − 1) × p by
|
|
7
|
+
* linear interpolation between the two nearest, and missing values are skipped. It returns null when no values remain
|
|
8
|
+
* or `p` is outside 0 to 1, and a footnote may name it "90th percentile (linear interpolation)."
|
|
9
|
+
*/
|
|
10
|
+
export declare function quantile(values: ReadonlyArray<number | null>, probability: number): number | null;
|
|
11
|
+
/** The smallest value, the quartiles, the median and the largest value of a set. */
|
|
12
|
+
export type FiveNumberSummary = {
|
|
13
|
+
readonly min: number;
|
|
14
|
+
readonly q1: number;
|
|
15
|
+
readonly median: number;
|
|
16
|
+
readonly q3: number;
|
|
17
|
+
readonly max: number;
|
|
18
|
+
/** How many values the summary describes. */
|
|
19
|
+
readonly count: number;
|
|
20
|
+
};
|
|
21
|
+
export type FiveNumberResult = TransformResult<{
|
|
22
|
+
readonly summary: FiveNumberSummary;
|
|
23
|
+
/** Values that were missing (null, NaN or infinite). */
|
|
24
|
+
readonly skipped: number;
|
|
25
|
+
}>;
|
|
26
|
+
/**
|
|
27
|
+
* The five numbers that outline a distribution: smallest, lower quartile, median, upper quartile and largest. The
|
|
28
|
+
* quartiles use the same linear interpolation as `quantile` (type 7), and missing values are skipped and counted. Name
|
|
29
|
+
* it in `transforms` as: "Quartiles by linear interpolation."
|
|
30
|
+
*/
|
|
31
|
+
export declare function fiveNumberSummary(values: ReadonlyArray<number | null>): FiveNumberResult;
|
|
32
|
+
/** How far a box plot's whiskers reach. */
|
|
33
|
+
export type WhiskerRule = 'tukey' | 'range';
|
|
34
|
+
/** What a box plot draws for one group. */
|
|
35
|
+
export type BoxSummary = {
|
|
36
|
+
/** The end of the lower whisker. */
|
|
37
|
+
readonly low: number;
|
|
38
|
+
readonly q1: number;
|
|
39
|
+
readonly median: number;
|
|
40
|
+
readonly q3: number;
|
|
41
|
+
/** The end of the upper whisker. */
|
|
42
|
+
readonly high: number;
|
|
43
|
+
/** The values beyond the whiskers, from smallest to largest. */
|
|
44
|
+
readonly outliers: ReadonlyArray<number>;
|
|
45
|
+
readonly count: number;
|
|
46
|
+
};
|
|
47
|
+
export type BoxSummaryResult = TransformResult<{
|
|
48
|
+
readonly summary: BoxSummary;
|
|
49
|
+
readonly whisker: WhiskerRule;
|
|
50
|
+
/** Values that were missing (null, NaN or infinite). */
|
|
51
|
+
readonly skipped: number;
|
|
52
|
+
}>;
|
|
53
|
+
/**
|
|
54
|
+
* The box, whiskers and outliers of a box plot, where the box spans the lower to the upper quartile with a line at the
|
|
55
|
+
* median (linear interpolation, type 7). With `whisker: 'tukey'` (Tukey's rule) each whisker reaches the furthest value
|
|
56
|
+
* within 1.5 box lengths of the box, and values beyond are outliers. With `'range'` the whiskers reach the smallest and
|
|
57
|
+
* largest values, and missing values are skipped and counted.
|
|
58
|
+
*/
|
|
59
|
+
export declare function boxSummary({ values, whisker, }: {
|
|
60
|
+
readonly values: ReadonlyArray<number | null>;
|
|
61
|
+
readonly whisker: WhiskerRule;
|
|
62
|
+
}): BoxSummaryResult;
|
|
63
|
+
/**
|
|
64
|
+
* The footnote for `boxSummary`: the quartile method, the whisker rule and the values left out, as in "Boxes show
|
|
65
|
+
* quartiles; whiskers reach 1.5 × IQR (Tukey); points beyond are outliers."
|
|
66
|
+
*/
|
|
67
|
+
export declare function describeBoxSummary({ result, locale, }: {
|
|
68
|
+
readonly result: TransformOk<BoxSummaryResult>;
|
|
69
|
+
readonly locale: string;
|
|
70
|
+
}): string;
|
|
71
|
+
/** One step of an empirical cumulative distribution. */
|
|
72
|
+
export type EcdfPoint = {
|
|
73
|
+
readonly id: string;
|
|
74
|
+
readonly value: number;
|
|
75
|
+
/** The share of values at or below `value`, from 0 to 1. */
|
|
76
|
+
readonly probability: number;
|
|
77
|
+
};
|
|
78
|
+
export type EcdfResult = TransformResult<{
|
|
79
|
+
readonly points: ReadonlyArray<EcdfPoint>;
|
|
80
|
+
readonly count: number;
|
|
81
|
+
/** Values that were missing (null, NaN or infinite). */
|
|
82
|
+
readonly skipped: number;
|
|
83
|
+
}>;
|
|
84
|
+
/**
|
|
85
|
+
* The empirical cumulative distribution: for each distinct value, the share of all values at or below it. A step chart
|
|
86
|
+
* of these points rises by 1/n at every value, and missing values are skipped and counted.
|
|
87
|
+
*/
|
|
88
|
+
export declare function ecdfPoints(values: ReadonlyArray<number | null>): EcdfResult;
|
|
89
|
+
/**
|
|
90
|
+
* The footnote for `ecdfPoints`: how many values the curve accumulates and how many were left out, as in "Empirical
|
|
91
|
+
* cumulative share of 1,200 values."
|
|
92
|
+
*/
|
|
93
|
+
export declare function describeEcdf({ result, locale, }: {
|
|
94
|
+
readonly result: TransformOk<EcdfResult>;
|
|
95
|
+
readonly locale: string;
|
|
96
|
+
}): string;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { TransformOk, TransformResult } from './values.ts';
|
|
2
|
+
/** Which value ranks first. */
|
|
3
|
+
export type RankOrder = 'descending' | 'ascending';
|
|
4
|
+
/** One thing ranked at every stage, such as a model across evaluation rounds. */
|
|
5
|
+
export type RankedItem = {
|
|
6
|
+
readonly id: string;
|
|
7
|
+
/** The value at each stage, keyed by stage id. A missing key or null means the item has no value there. */
|
|
8
|
+
readonly values: Readonly<Record<string, number | null>>;
|
|
9
|
+
};
|
|
10
|
+
/** An item's place at one stage; null where it had no value. */
|
|
11
|
+
export type StageRank = {
|
|
12
|
+
readonly stageId: string;
|
|
13
|
+
readonly rank: number | null;
|
|
14
|
+
readonly value: number | null;
|
|
15
|
+
};
|
|
16
|
+
export type RankSeriesResult = TransformResult<{
|
|
17
|
+
/** The items in their supplied order, each with one rank per stage in the order of `stages`. */
|
|
18
|
+
readonly items: ReadonlyArray<{
|
|
19
|
+
readonly id: string;
|
|
20
|
+
readonly ranks: ReadonlyArray<StageRank>;
|
|
21
|
+
}>;
|
|
22
|
+
readonly order: RankOrder;
|
|
23
|
+
readonly stageCount: number;
|
|
24
|
+
}>;
|
|
25
|
+
/**
|
|
26
|
+
* Ranks at each stage for a bump chart: items with a value are sorted and numbered from 1, and an item without one has
|
|
27
|
+
* no rank there. The order is highest first by default (`order: 'ascending'` puts the lowest first, as for a loss).
|
|
28
|
+
* Equal values are not given equal ranks: the item that comes first in `items` takes the better rank, so the order of
|
|
29
|
+
* `items` breaks ties.
|
|
30
|
+
*/
|
|
31
|
+
export declare function rankSeries({ items, stages, order, }: {
|
|
32
|
+
readonly items: ReadonlyArray<RankedItem>;
|
|
33
|
+
/** The stage ids, in the order the chart draws them. */
|
|
34
|
+
readonly stages: ReadonlyArray<string>;
|
|
35
|
+
readonly order?: RankOrder | undefined;
|
|
36
|
+
}): RankSeriesResult;
|
|
37
|
+
/**
|
|
38
|
+
* The footnote for `rankSeries`, as in "Ranked by value at each of 6 stages, highest first; ties keep the listed
|
|
39
|
+
* order."
|
|
40
|
+
*/
|
|
41
|
+
export declare function describeRanks({ result, locale, }: {
|
|
42
|
+
readonly result: TransformOk<RankSeriesResult>;
|
|
43
|
+
readonly locale: string;
|
|
44
|
+
}): string;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { SeriesPoint, TransformOk, TransformResult } from './values.ts';
|
|
2
|
+
/** One repeated run of the same measurement, such as a training seed. */
|
|
3
|
+
export type RunSeries = {
|
|
4
|
+
readonly id: string;
|
|
5
|
+
readonly points: ReadonlyArray<SeriesPoint>;
|
|
6
|
+
};
|
|
7
|
+
/** The middle of the runs at one step and the band that holds them. */
|
|
8
|
+
export type RunSummaryPoint = {
|
|
9
|
+
readonly x: number;
|
|
10
|
+
/** The median across runs. */
|
|
11
|
+
readonly center: number;
|
|
12
|
+
readonly lower: number;
|
|
13
|
+
readonly upper: number;
|
|
14
|
+
};
|
|
15
|
+
export type SummarizeRunsInput = {
|
|
16
|
+
readonly runs: ReadonlyArray<RunSeries>;
|
|
17
|
+
/** The quantile for the band's lower edge, from 0 to 1: 0.25 for the lower quartile. */
|
|
18
|
+
readonly lower: number;
|
|
19
|
+
/** The quantile for the band's upper edge, from 0 to 1, at or above `lower`. */
|
|
20
|
+
readonly upper: number;
|
|
21
|
+
/** The fewest runs a step needs to be summarized. Defaults to every run. */
|
|
22
|
+
readonly minimumRuns?: number | undefined;
|
|
23
|
+
};
|
|
24
|
+
export type SummarizeRunsResult = TransformResult<{
|
|
25
|
+
readonly points: ReadonlyArray<RunSummaryPoint>;
|
|
26
|
+
readonly lower: number;
|
|
27
|
+
readonly upper: number;
|
|
28
|
+
readonly runCount: number;
|
|
29
|
+
readonly minimumRuns: number;
|
|
30
|
+
/** Steps that fewer than `minimumRuns` runs reported. */
|
|
31
|
+
readonly skippedSteps: number;
|
|
32
|
+
}>;
|
|
33
|
+
/**
|
|
34
|
+
* The median and a quantile band across repeated runs, step by step, for a line with a pale band that never rests on
|
|
35
|
+
* too few runs. At each x that at least `minimumRuns` runs report a value for, it takes the median of those values and
|
|
36
|
+
* the `lower` and `upper` quantiles (linear interpolation, type 7). Steps reported by fewer runs are skipped and
|
|
37
|
+
* counted, and a missing value does not count as a report.
|
|
38
|
+
*/
|
|
39
|
+
export declare function summarizeRuns({ runs, lower, upper, minimumRuns, }: SummarizeRunsInput): SummarizeRunsResult;
|
|
40
|
+
/**
|
|
41
|
+
* The footnote for `summarizeRuns`: the center, the band and the steps left out, as in "Median of 5 runs; band spans
|
|
42
|
+
* quantiles 0.25 to 0.75."
|
|
43
|
+
*/
|
|
44
|
+
export declare function describeRunSummary({ result, locale, }: {
|
|
45
|
+
readonly result: TransformOk<SummarizeRunsResult>;
|
|
46
|
+
readonly locale: string;
|
|
47
|
+
}): string;
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import type { FigureCoverage } from '../figure/figure-props.ts';
|
|
2
|
+
import type { SeriesPoint, TransformOk, TransformResult } from './values.ts';
|
|
3
|
+
/** A sample of a long list: the indices kept, in increasing order, and the figure coverage that states the share. */
|
|
4
|
+
export type SampleResult = TransformResult<{
|
|
5
|
+
readonly indices: ReadonlyArray<number>;
|
|
6
|
+
readonly coverage: FigureCoverage;
|
|
7
|
+
/** The seed of a random sample; null for an even one. */
|
|
8
|
+
readonly seed: number | null;
|
|
9
|
+
}>;
|
|
10
|
+
export type DownsampleResult = TransformResult<{
|
|
11
|
+
readonly points: ReadonlyArray<SeriesPoint>;
|
|
12
|
+
readonly coverage: FigureCoverage;
|
|
13
|
+
}>;
|
|
14
|
+
/**
|
|
15
|
+
* Thin a long series to about `target` points before drawing it, with largest-triangle-three-buckets (Steinarsson,
|
|
16
|
+
* 2013), so peaks, dips and the first and last points survive. The points are split into equal buckets, and each bucket
|
|
17
|
+
* keeps the point that makes the largest triangle with its chosen neighbours. Gaps are kept: each run of missing points
|
|
18
|
+
* stays as one missing point, and the budget is shared among the runs between gaps by their length.
|
|
19
|
+
*/
|
|
20
|
+
export declare function downsample({ points, target, unit, }: {
|
|
21
|
+
/** The series in order of x, which must not decrease. */
|
|
22
|
+
readonly points: ReadonlyArray<SeriesPoint>;
|
|
23
|
+
/** About how many points to keep; at least 3. */
|
|
24
|
+
readonly target: number;
|
|
25
|
+
/** What the coverage counts, in the plural. Defaults to "points". */
|
|
26
|
+
readonly unit?: string | undefined;
|
|
27
|
+
}): DownsampleResult;
|
|
28
|
+
/** The footnote for `downsample`, as in "1,000 of 50,000 points shown (largest triangle three buckets)." */
|
|
29
|
+
export declare function describeDownsample({ result, locale, }: {
|
|
30
|
+
readonly result: TransformOk<DownsampleResult>;
|
|
31
|
+
readonly locale: string;
|
|
32
|
+
}): string;
|
|
33
|
+
/**
|
|
34
|
+
* The footnote for `sampleEvenly` and `reservoirIndices`, as in "2,000 of 80,000 points shown (evenly spaced)." or
|
|
35
|
+
* "2,000 of 80,000 points shown (random sample, seed 7)."
|
|
36
|
+
*/
|
|
37
|
+
export declare function describeSample({ result, locale, }: {
|
|
38
|
+
readonly result: TransformOk<SampleResult>;
|
|
39
|
+
readonly locale: string;
|
|
40
|
+
}): string;
|
|
41
|
+
/**
|
|
42
|
+
* Choose about `target` of `count` indices spread evenly from the first to the last, for drawing a sample of a large
|
|
43
|
+
* point set. Index i of the sample is round(i × (count − 1) / (target − 1)), so the first and last are always kept.
|
|
44
|
+
* Draw `points[index]` for each index and pass `coverage` to the figure.
|
|
45
|
+
*/
|
|
46
|
+
export declare function sampleEvenly({ count, target, unit, }: {
|
|
47
|
+
/** How many items the full set has. */
|
|
48
|
+
readonly count: number;
|
|
49
|
+
readonly target: number;
|
|
50
|
+
/** What the coverage counts, in the plural. Defaults to "points". */
|
|
51
|
+
readonly unit?: string | undefined;
|
|
52
|
+
}): SampleResult;
|
|
53
|
+
/**
|
|
54
|
+
* `count` pseudo-random numbers between 0 and 1 from the "minimal standard" Lehmer generator (Park and Miller, with
|
|
55
|
+
* multiplier 48271): each number is the previous one times 48271, modulo 2³¹ − 1. It is small and plain arithmetic, so
|
|
56
|
+
* the same seed always gives the same numbers on every machine, and a longer sequence starts with the shorter one.
|
|
57
|
+
*/
|
|
58
|
+
export declare function seededUniforms({ seed, count, }: {
|
|
59
|
+
readonly seed: number;
|
|
60
|
+
readonly count: number;
|
|
61
|
+
}): ReadonlyArray<number>;
|
|
62
|
+
/**
|
|
63
|
+
* Choose `target` of `count` indices at random, each equally likely, and the same ones every time for the same seed.
|
|
64
|
+
* Index i gets the i-th number of `seededUniforms` as its key, and the indices with the `target` smallest keys are kept
|
|
65
|
+
* (random-key reservoir sampling), returned in increasing order. Growing `count` keeps an earlier sample's indices
|
|
66
|
+
* unless a new key undercuts them.
|
|
67
|
+
*/
|
|
68
|
+
export declare function reservoirIndices({ count, target, seed, unit, }: {
|
|
69
|
+
readonly count: number;
|
|
70
|
+
readonly target: number;
|
|
71
|
+
/** Any whole number. The same seed gives the same sample. */
|
|
72
|
+
readonly seed: number;
|
|
73
|
+
/** What the coverage counts, in the plural. Defaults to "points". */
|
|
74
|
+
readonly unit?: string | undefined;
|
|
75
|
+
}): SampleResult;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { SeriesPoint, TransformOk, TransformResult } from './values.ts';
|
|
2
|
+
export type MovingAverageResult = TransformResult<{
|
|
3
|
+
readonly points: ReadonlyArray<SeriesPoint>;
|
|
4
|
+
/** How many points each mean spans. */
|
|
5
|
+
readonly size: number;
|
|
6
|
+
}>;
|
|
7
|
+
export type ExponentialSmoothingResult = TransformResult<{
|
|
8
|
+
readonly points: ReadonlyArray<SeriesPoint>;
|
|
9
|
+
readonly weight: number;
|
|
10
|
+
}>;
|
|
11
|
+
/**
|
|
12
|
+
* A trailing moving average: each point becomes the mean of the observed values among itself and the `size − 1` points
|
|
13
|
+
* before it. The first points average over fewer values, and a missing point (null, NaN or infinite) stays missing. It
|
|
14
|
+
* is not counted in its neighbours' means, so gaps in the line are kept.
|
|
15
|
+
*/
|
|
16
|
+
export declare function movingAverage({ points, size, }: {
|
|
17
|
+
readonly points: ReadonlyArray<SeriesPoint>;
|
|
18
|
+
/** How many points each mean spans, the point itself included. */
|
|
19
|
+
readonly size: number;
|
|
20
|
+
}): MovingAverageResult;
|
|
21
|
+
/** The footnote for `movingAverage`, as in "Trailing mean over 10 points." */
|
|
22
|
+
export declare function describeMovingAverage({ result, locale, }: {
|
|
23
|
+
readonly result: TransformOk<MovingAverageResult>;
|
|
24
|
+
readonly locale: string;
|
|
25
|
+
}): string;
|
|
26
|
+
/**
|
|
27
|
+
* The exponential moving average that training dashboards draw over a noisy loss: each smoothed value is `weight` times
|
|
28
|
+
* the previous one plus `1 − weight` times the new value. Because the average starts from zero, each value is then
|
|
29
|
+
* divided by 1 − weight^n (n = values seen so far), the debiased form TensorBoard uses. That removes the pull toward
|
|
30
|
+
* zero at the start, and a missing point stays missing and does not move the average.
|
|
31
|
+
*/
|
|
32
|
+
export declare function exponentialSmoothing({ points, weight, }: {
|
|
33
|
+
readonly points: ReadonlyArray<SeriesPoint>;
|
|
34
|
+
/** How much of the previous average each step keeps, from 0 (no smoothing) up to but not including 1. */
|
|
35
|
+
readonly weight: number;
|
|
36
|
+
}): ExponentialSmoothingResult;
|
|
37
|
+
/** The footnote for `exponentialSmoothing`, as in "Exponential moving average, weight 0.9, debiased." */
|
|
38
|
+
export declare function describeExponentialSmoothing({ result, locale, }: {
|
|
39
|
+
readonly result: TransformOk<ExponentialSmoothingResult>;
|
|
40
|
+
readonly locale: string;
|
|
41
|
+
}): string;
|