shap-svg 0.2.1 → 0.2.2
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 +38 -0
- package/dist/{chunk-ZWO4CN22.js → chunk-4X6PMJYT.js} +91 -35
- package/dist/chunk-4X6PMJYT.js.map +1 -0
- package/dist/index.cjs +92 -34
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +15 -7
- package/dist/index.d.ts +15 -7
- package/dist/index.js +5 -1
- package/dist/{format-wEav_cPe.d.cts → labels-7wofev8M.d.cts} +44 -1
- package/dist/{format-wEav_cPe.d.ts → labels-7wofev8M.d.ts} +44 -1
- package/dist/react.cjs +120 -51
- package/dist/react.cjs.map +1 -1
- package/dist/react.d.cts +29 -5
- package/dist/react.d.ts +29 -5
- package/dist/react.js +35 -18
- package/dist/react.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-ZWO4CN22.js.map +0 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { P as ParsedExplanation, D as DisplayRows, V as ValuePrecision, R as RowSort } from './
|
|
2
|
-
export {
|
|
1
|
+
import { P as ParsedExplanation, a as PlotLabels, D as DisplayRows, V as ValuePrecision, R as RowSort } from './labels-7wofev8M.cjs';
|
|
2
|
+
export { b as DisplayRow, E as Explanation, I as InvalidExplanationError, U as UnsupportedContractVersionError, f as formatFeatureLabel, c as formatLevel, d as formatShapValue, r as resolveLabels, s as shapLabels, e as sortDisplayRows } from './labels-7wofev8M.cjs';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Taxonomy-aware views of an Explanation.
|
|
@@ -68,7 +68,7 @@ declare function orderFeatures(importance: number[]): number[];
|
|
|
68
68
|
* absorbs the Feature ranked `maxDisplay` — so maxDisplay=15 shows 14 real Features. The default
|
|
69
69
|
* corrected mode shows `maxDisplay` real Features and adds the Other features row alongside.
|
|
70
70
|
*/
|
|
71
|
-
declare function collapseToDisplay(featureNames: string[], importance: number[], order: number[], maxDisplay: number, faithfulOtherRow: boolean): DisplayRows;
|
|
71
|
+
declare function collapseToDisplay(featureNames: string[], importance: number[], order: number[], maxDisplay: number, faithfulOtherRow: boolean, labels?: PlotLabels): DisplayRows;
|
|
72
72
|
|
|
73
73
|
type AxisTick = {
|
|
74
74
|
value: number;
|
|
@@ -95,6 +95,8 @@ type BarLayoutOptions = {
|
|
|
95
95
|
marginLeft: number;
|
|
96
96
|
marginRight: number;
|
|
97
97
|
marginTop: number;
|
|
98
|
+
/** Resolved wording; SHAP's when omitted. */
|
|
99
|
+
labels?: PlotLabels;
|
|
98
100
|
};
|
|
99
101
|
type BarGeometry = {
|
|
100
102
|
label: string;
|
|
@@ -170,6 +172,8 @@ type WaterfallLayoutOptions = {
|
|
|
170
172
|
marginTop: number;
|
|
171
173
|
/** Decimal places for the bar labels. Display only; omit for 3 significant figures. */
|
|
172
174
|
decimals?: ValuePrecision;
|
|
175
|
+
/** Resolved wording; SHAP's when omitted. */
|
|
176
|
+
labels?: PlotLabels;
|
|
173
177
|
};
|
|
174
178
|
type Point = {
|
|
175
179
|
x: number;
|
|
@@ -245,7 +249,7 @@ type WaterfallLayout = {
|
|
|
245
249
|
* The value-space part of shap/plots/_waterfall.py::waterfall_legacy.
|
|
246
250
|
* It walks backward from f(x), leaving pixel scaling and arrowheads to waterfallLayout.
|
|
247
251
|
*/
|
|
248
|
-
declare function waterfallRows(explanation: ParsedExplanation, sampleIndex: number, maxDisplay: number, faithfulOtherRow: boolean): WaterfallRows;
|
|
252
|
+
declare function waterfallRows(explanation: ParsedExplanation, sampleIndex: number, maxDisplay: number, faithfulOtherRow: boolean, labels?: PlotLabels): WaterfallRows;
|
|
249
253
|
declare function waterfallLayout(valueRows: WaterfallRows, opts: WaterfallLayoutOptions): WaterfallLayout;
|
|
250
254
|
|
|
251
255
|
type ColormapName = "red_blue" | "red_white_blue";
|
|
@@ -371,6 +375,8 @@ type BeeswarmLayoutOptions = {
|
|
|
371
375
|
dotRadius: number;
|
|
372
376
|
/** Draw SHAP's feature value colour bar right of the plot. */
|
|
373
377
|
colorBar?: boolean;
|
|
378
|
+
/** Resolved wording; SHAP's when omitted. */
|
|
379
|
+
labels?: PlotLabels;
|
|
374
380
|
};
|
|
375
381
|
type BeeswarmPointGeometry = Omit<BeeswarmPoint, "x" | "y"> & {
|
|
376
382
|
x: number;
|
|
@@ -401,7 +407,7 @@ type BeeswarmLayout = {
|
|
|
401
407
|
* Computes SHAP-compatible beeswarm rows entirely in value space. Pixel scaling belongs in
|
|
402
408
|
* beeswarmLayout so golden values can be compared without a viewport.
|
|
403
409
|
*/
|
|
404
|
-
declare function beeswarmRows(explanation: ParsedExplanation, maxDisplay: number, faithfulOtherRow: boolean, seed?: number, rowSort?: RowSort): BeeswarmRows;
|
|
410
|
+
declare function beeswarmRows(explanation: ParsedExplanation, maxDisplay: number, faithfulOtherRow: boolean, seed?: number, rowSort?: RowSort, labels?: PlotLabels): BeeswarmRows;
|
|
405
411
|
/** Projects beeswarm value-space rows into SVG coordinates. */
|
|
406
412
|
declare function beeswarmLayout(valueRows: BeeswarmRows, opts: BeeswarmLayoutOptions): BeeswarmLayout;
|
|
407
413
|
|
|
@@ -454,6 +460,8 @@ type HeatmapLayoutOptions = {
|
|
|
454
460
|
marginTop: number;
|
|
455
461
|
/** Draw SHAP's SHAP value colour bar right of the side bars. */
|
|
456
462
|
colorBar?: boolean;
|
|
463
|
+
/** Resolved wording; SHAP's when omitted. */
|
|
464
|
+
labels?: PlotLabels;
|
|
457
465
|
};
|
|
458
466
|
type HeatmapCellGeometry = HeatmapCell & {
|
|
459
467
|
x: number;
|
|
@@ -538,8 +546,8 @@ type HeatmapLayout = {
|
|
|
538
546
|
height: number;
|
|
539
547
|
};
|
|
540
548
|
/** Computes the SHAP-compatible orderings, collapse, colours, line, and side bars in value space. */
|
|
541
|
-
declare function heatmapRows(explanation: ParsedExplanation, maxDisplay: number, faithfulOtherRow: boolean, rowSort?: RowSort): HeatmapRows;
|
|
549
|
+
declare function heatmapRows(explanation: ParsedExplanation, maxDisplay: number, faithfulOtherRow: boolean, rowSort?: RowSort, labels?: PlotLabels): HeatmapRows;
|
|
542
550
|
/** Projects heatmap value-space rows into SVG geometry. */
|
|
543
551
|
declare function heatmapLayout(valueRows: HeatmapRows, opts: HeatmapLayoutOptions): HeatmapLayout;
|
|
544
552
|
|
|
545
|
-
export { type AggregatedExplanation, BEESWARM_MISSING_COLOR, BEESWARM_ROW_HEIGHT, type BarGeometry, type BarLayout, type BarLayoutOptions, type BeeswarmLayout, type BeeswarmLayoutOptions, type BeeswarmPoint, type BeeswarmPointGeometry, type BeeswarmRow, type BeeswarmRowGeometry, type BeeswarmRows, type ColorBarGeometry, type ColorBarSpec, type ColorBarStep, type ColorBarTick, type ColormapName, DisplayRows, type GenusGrouping, type HeatmapAxisMark, type HeatmapCell, type HeatmapCellGeometry, type HeatmapColumn, type HeatmapColumnGeometry, type HeatmapLayout, type HeatmapLayoutOptions, type HeatmapLinePoint, type HeatmapRow, type HeatmapRowGeometry, type HeatmapRows, type HeatmapSideBarGeometry, type HeatmapSpine, type HeatmapYTick, NEGATIVE_COLOR, POSITIVE_COLOR, ParsedExplanation, type Point, RowSort, ValuePrecision, WATERFALL_BASE_LABEL_DY, WATERFALL_HEAD_LENGTH_PX, WATERFALL_TICK_LABEL_DY, type WaterfallArrowGeometry, type WaterfallAxisMark, type WaterfallConnector, type WaterfallLayout, type WaterfallLayoutOptions, type WaterfallRow, type WaterfallRows, type WaterfallSeparator, type WaterfallTick, type WaterfallValueLabel, aggregateByGenus, barLayout, beeswarmLayout, beeswarmRows, collapseToDisplay, colorBarExtent, colorBarLayout, fitColorBar, genusOf, globalImportance, groupByGenus, groupExplanationByGenus, heatmapLayout, heatmapRows, orderFeatures, parseExplanation, sampleColormap, scalarFormatterLabels, waterfallLayout, waterfallRows };
|
|
553
|
+
export { type AggregatedExplanation, BEESWARM_MISSING_COLOR, BEESWARM_ROW_HEIGHT, type BarGeometry, type BarLayout, type BarLayoutOptions, type BeeswarmLayout, type BeeswarmLayoutOptions, type BeeswarmPoint, type BeeswarmPointGeometry, type BeeswarmRow, type BeeswarmRowGeometry, type BeeswarmRows, type ColorBarGeometry, type ColorBarSpec, type ColorBarStep, type ColorBarTick, type ColormapName, DisplayRows, type GenusGrouping, type HeatmapAxisMark, type HeatmapCell, type HeatmapCellGeometry, type HeatmapColumn, type HeatmapColumnGeometry, type HeatmapLayout, type HeatmapLayoutOptions, type HeatmapLinePoint, type HeatmapRow, type HeatmapRowGeometry, type HeatmapRows, type HeatmapSideBarGeometry, type HeatmapSpine, type HeatmapYTick, NEGATIVE_COLOR, POSITIVE_COLOR, ParsedExplanation, PlotLabels, type Point, RowSort, ValuePrecision, WATERFALL_BASE_LABEL_DY, WATERFALL_HEAD_LENGTH_PX, WATERFALL_TICK_LABEL_DY, type WaterfallArrowGeometry, type WaterfallAxisMark, type WaterfallConnector, type WaterfallLayout, type WaterfallLayoutOptions, type WaterfallRow, type WaterfallRows, type WaterfallSeparator, type WaterfallTick, type WaterfallValueLabel, aggregateByGenus, barLayout, beeswarmLayout, beeswarmRows, collapseToDisplay, colorBarExtent, colorBarLayout, fitColorBar, genusOf, globalImportance, groupByGenus, groupExplanationByGenus, heatmapLayout, heatmapRows, orderFeatures, parseExplanation, sampleColormap, scalarFormatterLabels, waterfallLayout, waterfallRows };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { P as ParsedExplanation, D as DisplayRows, V as ValuePrecision, R as RowSort } from './
|
|
2
|
-
export {
|
|
1
|
+
import { P as ParsedExplanation, a as PlotLabels, D as DisplayRows, V as ValuePrecision, R as RowSort } from './labels-7wofev8M.js';
|
|
2
|
+
export { b as DisplayRow, E as Explanation, I as InvalidExplanationError, U as UnsupportedContractVersionError, f as formatFeatureLabel, c as formatLevel, d as formatShapValue, r as resolveLabels, s as shapLabels, e as sortDisplayRows } from './labels-7wofev8M.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Taxonomy-aware views of an Explanation.
|
|
@@ -68,7 +68,7 @@ declare function orderFeatures(importance: number[]): number[];
|
|
|
68
68
|
* absorbs the Feature ranked `maxDisplay` — so maxDisplay=15 shows 14 real Features. The default
|
|
69
69
|
* corrected mode shows `maxDisplay` real Features and adds the Other features row alongside.
|
|
70
70
|
*/
|
|
71
|
-
declare function collapseToDisplay(featureNames: string[], importance: number[], order: number[], maxDisplay: number, faithfulOtherRow: boolean): DisplayRows;
|
|
71
|
+
declare function collapseToDisplay(featureNames: string[], importance: number[], order: number[], maxDisplay: number, faithfulOtherRow: boolean, labels?: PlotLabels): DisplayRows;
|
|
72
72
|
|
|
73
73
|
type AxisTick = {
|
|
74
74
|
value: number;
|
|
@@ -95,6 +95,8 @@ type BarLayoutOptions = {
|
|
|
95
95
|
marginLeft: number;
|
|
96
96
|
marginRight: number;
|
|
97
97
|
marginTop: number;
|
|
98
|
+
/** Resolved wording; SHAP's when omitted. */
|
|
99
|
+
labels?: PlotLabels;
|
|
98
100
|
};
|
|
99
101
|
type BarGeometry = {
|
|
100
102
|
label: string;
|
|
@@ -170,6 +172,8 @@ type WaterfallLayoutOptions = {
|
|
|
170
172
|
marginTop: number;
|
|
171
173
|
/** Decimal places for the bar labels. Display only; omit for 3 significant figures. */
|
|
172
174
|
decimals?: ValuePrecision;
|
|
175
|
+
/** Resolved wording; SHAP's when omitted. */
|
|
176
|
+
labels?: PlotLabels;
|
|
173
177
|
};
|
|
174
178
|
type Point = {
|
|
175
179
|
x: number;
|
|
@@ -245,7 +249,7 @@ type WaterfallLayout = {
|
|
|
245
249
|
* The value-space part of shap/plots/_waterfall.py::waterfall_legacy.
|
|
246
250
|
* It walks backward from f(x), leaving pixel scaling and arrowheads to waterfallLayout.
|
|
247
251
|
*/
|
|
248
|
-
declare function waterfallRows(explanation: ParsedExplanation, sampleIndex: number, maxDisplay: number, faithfulOtherRow: boolean): WaterfallRows;
|
|
252
|
+
declare function waterfallRows(explanation: ParsedExplanation, sampleIndex: number, maxDisplay: number, faithfulOtherRow: boolean, labels?: PlotLabels): WaterfallRows;
|
|
249
253
|
declare function waterfallLayout(valueRows: WaterfallRows, opts: WaterfallLayoutOptions): WaterfallLayout;
|
|
250
254
|
|
|
251
255
|
type ColormapName = "red_blue" | "red_white_blue";
|
|
@@ -371,6 +375,8 @@ type BeeswarmLayoutOptions = {
|
|
|
371
375
|
dotRadius: number;
|
|
372
376
|
/** Draw SHAP's feature value colour bar right of the plot. */
|
|
373
377
|
colorBar?: boolean;
|
|
378
|
+
/** Resolved wording; SHAP's when omitted. */
|
|
379
|
+
labels?: PlotLabels;
|
|
374
380
|
};
|
|
375
381
|
type BeeswarmPointGeometry = Omit<BeeswarmPoint, "x" | "y"> & {
|
|
376
382
|
x: number;
|
|
@@ -401,7 +407,7 @@ type BeeswarmLayout = {
|
|
|
401
407
|
* Computes SHAP-compatible beeswarm rows entirely in value space. Pixel scaling belongs in
|
|
402
408
|
* beeswarmLayout so golden values can be compared without a viewport.
|
|
403
409
|
*/
|
|
404
|
-
declare function beeswarmRows(explanation: ParsedExplanation, maxDisplay: number, faithfulOtherRow: boolean, seed?: number, rowSort?: RowSort): BeeswarmRows;
|
|
410
|
+
declare function beeswarmRows(explanation: ParsedExplanation, maxDisplay: number, faithfulOtherRow: boolean, seed?: number, rowSort?: RowSort, labels?: PlotLabels): BeeswarmRows;
|
|
405
411
|
/** Projects beeswarm value-space rows into SVG coordinates. */
|
|
406
412
|
declare function beeswarmLayout(valueRows: BeeswarmRows, opts: BeeswarmLayoutOptions): BeeswarmLayout;
|
|
407
413
|
|
|
@@ -454,6 +460,8 @@ type HeatmapLayoutOptions = {
|
|
|
454
460
|
marginTop: number;
|
|
455
461
|
/** Draw SHAP's SHAP value colour bar right of the side bars. */
|
|
456
462
|
colorBar?: boolean;
|
|
463
|
+
/** Resolved wording; SHAP's when omitted. */
|
|
464
|
+
labels?: PlotLabels;
|
|
457
465
|
};
|
|
458
466
|
type HeatmapCellGeometry = HeatmapCell & {
|
|
459
467
|
x: number;
|
|
@@ -538,8 +546,8 @@ type HeatmapLayout = {
|
|
|
538
546
|
height: number;
|
|
539
547
|
};
|
|
540
548
|
/** Computes the SHAP-compatible orderings, collapse, colours, line, and side bars in value space. */
|
|
541
|
-
declare function heatmapRows(explanation: ParsedExplanation, maxDisplay: number, faithfulOtherRow: boolean, rowSort?: RowSort): HeatmapRows;
|
|
549
|
+
declare function heatmapRows(explanation: ParsedExplanation, maxDisplay: number, faithfulOtherRow: boolean, rowSort?: RowSort, labels?: PlotLabels): HeatmapRows;
|
|
542
550
|
/** Projects heatmap value-space rows into SVG geometry. */
|
|
543
551
|
declare function heatmapLayout(valueRows: HeatmapRows, opts: HeatmapLayoutOptions): HeatmapLayout;
|
|
544
552
|
|
|
545
|
-
export { type AggregatedExplanation, BEESWARM_MISSING_COLOR, BEESWARM_ROW_HEIGHT, type BarGeometry, type BarLayout, type BarLayoutOptions, type BeeswarmLayout, type BeeswarmLayoutOptions, type BeeswarmPoint, type BeeswarmPointGeometry, type BeeswarmRow, type BeeswarmRowGeometry, type BeeswarmRows, type ColorBarGeometry, type ColorBarSpec, type ColorBarStep, type ColorBarTick, type ColormapName, DisplayRows, type GenusGrouping, type HeatmapAxisMark, type HeatmapCell, type HeatmapCellGeometry, type HeatmapColumn, type HeatmapColumnGeometry, type HeatmapLayout, type HeatmapLayoutOptions, type HeatmapLinePoint, type HeatmapRow, type HeatmapRowGeometry, type HeatmapRows, type HeatmapSideBarGeometry, type HeatmapSpine, type HeatmapYTick, NEGATIVE_COLOR, POSITIVE_COLOR, ParsedExplanation, type Point, RowSort, ValuePrecision, WATERFALL_BASE_LABEL_DY, WATERFALL_HEAD_LENGTH_PX, WATERFALL_TICK_LABEL_DY, type WaterfallArrowGeometry, type WaterfallAxisMark, type WaterfallConnector, type WaterfallLayout, type WaterfallLayoutOptions, type WaterfallRow, type WaterfallRows, type WaterfallSeparator, type WaterfallTick, type WaterfallValueLabel, aggregateByGenus, barLayout, beeswarmLayout, beeswarmRows, collapseToDisplay, colorBarExtent, colorBarLayout, fitColorBar, genusOf, globalImportance, groupByGenus, groupExplanationByGenus, heatmapLayout, heatmapRows, orderFeatures, parseExplanation, sampleColormap, scalarFormatterLabels, waterfallLayout, waterfallRows };
|
|
553
|
+
export { type AggregatedExplanation, BEESWARM_MISSING_COLOR, BEESWARM_ROW_HEIGHT, type BarGeometry, type BarLayout, type BarLayoutOptions, type BeeswarmLayout, type BeeswarmLayoutOptions, type BeeswarmPoint, type BeeswarmPointGeometry, type BeeswarmRow, type BeeswarmRowGeometry, type BeeswarmRows, type ColorBarGeometry, type ColorBarSpec, type ColorBarStep, type ColorBarTick, type ColormapName, DisplayRows, type GenusGrouping, type HeatmapAxisMark, type HeatmapCell, type HeatmapCellGeometry, type HeatmapColumn, type HeatmapColumnGeometry, type HeatmapLayout, type HeatmapLayoutOptions, type HeatmapLinePoint, type HeatmapRow, type HeatmapRowGeometry, type HeatmapRows, type HeatmapSideBarGeometry, type HeatmapSpine, type HeatmapYTick, NEGATIVE_COLOR, POSITIVE_COLOR, ParsedExplanation, PlotLabels, type Point, RowSort, ValuePrecision, WATERFALL_BASE_LABEL_DY, WATERFALL_HEAD_LENGTH_PX, WATERFALL_TICK_LABEL_DY, type WaterfallArrowGeometry, type WaterfallAxisMark, type WaterfallConnector, type WaterfallLayout, type WaterfallLayoutOptions, type WaterfallRow, type WaterfallRows, type WaterfallSeparator, type WaterfallTick, type WaterfallValueLabel, aggregateByGenus, barLayout, beeswarmLayout, beeswarmRows, collapseToDisplay, colorBarExtent, colorBarLayout, fitColorBar, genusOf, globalImportance, groupByGenus, groupExplanationByGenus, heatmapLayout, heatmapRows, orderFeatures, parseExplanation, sampleColormap, scalarFormatterLabels, waterfallLayout, waterfallRows };
|
package/dist/index.js
CHANGED
|
@@ -27,12 +27,14 @@ import {
|
|
|
27
27
|
heatmapRows,
|
|
28
28
|
orderFeatures,
|
|
29
29
|
parseExplanation,
|
|
30
|
+
resolveLabels,
|
|
30
31
|
sampleColormap,
|
|
31
32
|
scalarFormatterLabels,
|
|
33
|
+
shapLabels,
|
|
32
34
|
sortDisplayRows,
|
|
33
35
|
waterfallLayout,
|
|
34
36
|
waterfallRows
|
|
35
|
-
} from "./chunk-
|
|
37
|
+
} from "./chunk-4X6PMJYT.js";
|
|
36
38
|
export {
|
|
37
39
|
BEESWARM_MISSING_COLOR,
|
|
38
40
|
BEESWARM_ROW_HEIGHT,
|
|
@@ -62,8 +64,10 @@ export {
|
|
|
62
64
|
heatmapRows,
|
|
63
65
|
orderFeatures,
|
|
64
66
|
parseExplanation,
|
|
67
|
+
resolveLabels,
|
|
65
68
|
sampleColormap,
|
|
66
69
|
scalarFormatterLabels,
|
|
70
|
+
shapLabels,
|
|
67
71
|
sortDisplayRows,
|
|
68
72
|
waterfallLayout,
|
|
69
73
|
waterfallRows
|
|
@@ -108,4 +108,47 @@ declare function formatLevel(v: number, decimals?: ValuePrecision): string;
|
|
|
108
108
|
/** Spec 3.5 V3. The italic styling is applied by the renderer, not here. */
|
|
109
109
|
declare function formatFeatureLabel(name: string): string;
|
|
110
110
|
|
|
111
|
-
|
|
111
|
+
/**
|
|
112
|
+
* Every piece of text the charts draw, keyed by what it means rather than where
|
|
113
|
+
* it appears, so a word used in two places is changed once.
|
|
114
|
+
*
|
|
115
|
+
* The defaults are SHAP 0.49.1's own wording: a chart given no labels reads the
|
|
116
|
+
* way SHAP's figures do.
|
|
117
|
+
*/
|
|
118
|
+
type PlotLabels = {
|
|
119
|
+
/** The value itself, as the beeswarm tooltip names it. */
|
|
120
|
+
shapValue: string;
|
|
121
|
+
/** The axis that measures it: beeswarm x axis and heatmap colour bar (_labels.py VALUE). */
|
|
122
|
+
shapValueAxis: string;
|
|
123
|
+
/** The bar chart's x axis. */
|
|
124
|
+
meanAbsShapValue: string;
|
|
125
|
+
/** A Feature's input value: beeswarm tooltip and colour bar title. */
|
|
126
|
+
featureValue: string;
|
|
127
|
+
/** The low end of the beeswarm colour bar. */
|
|
128
|
+
featureValueLow: string;
|
|
129
|
+
/** The high end of the beeswarm colour bar. */
|
|
130
|
+
featureValueHigh: string;
|
|
131
|
+
/** Written in place of a Feature value the payload does not have. */
|
|
132
|
+
missingFeatureValue: string;
|
|
133
|
+
/** The heatmap's Sample axis. */
|
|
134
|
+
samples: string;
|
|
135
|
+
/** A Sample's summed SHAP values, in the heatmap tooltip. */
|
|
136
|
+
sampleTotal: string;
|
|
137
|
+
/** A Sample the payload gives no label, numbered from 1. */
|
|
138
|
+
sampleFallback: (sampleNumber: number) => string;
|
|
139
|
+
/** The waterfall's starting point, E[f(X)]. */
|
|
140
|
+
baseValue: string;
|
|
141
|
+
/** The waterfall's end point, f(x). */
|
|
142
|
+
modelOutput: string;
|
|
143
|
+
/**
|
|
144
|
+
* The row standing in for every Feature not shown. `style` is "sum" for the
|
|
145
|
+
* bar, beeswarm and heatmap row in faithfulOtherRow mode, which SHAP titles as
|
|
146
|
+
* a sum, and "count" everywhere else.
|
|
147
|
+
*/
|
|
148
|
+
otherFeatures: (count: number, style: "sum" | "count") => string;
|
|
149
|
+
};
|
|
150
|
+
declare const shapLabels: PlotLabels;
|
|
151
|
+
/** The given wording over SHAP's. A key given as undefined keeps the default. */
|
|
152
|
+
declare function resolveLabels(labels?: Partial<PlotLabels>): PlotLabels;
|
|
153
|
+
|
|
154
|
+
export { type DisplayRows as D, type Explanation as E, InvalidExplanationError as I, type ParsedExplanation as P, type RowSort as R, UnsupportedContractVersionError as U, type ValuePrecision as V, type PlotLabels as a, type DisplayRow as b, formatLevel as c, formatShapValue as d, sortDisplayRows as e, formatFeatureLabel as f, resolveLabels as r, shapLabels as s };
|
|
@@ -108,4 +108,47 @@ declare function formatLevel(v: number, decimals?: ValuePrecision): string;
|
|
|
108
108
|
/** Spec 3.5 V3. The italic styling is applied by the renderer, not here. */
|
|
109
109
|
declare function formatFeatureLabel(name: string): string;
|
|
110
110
|
|
|
111
|
-
|
|
111
|
+
/**
|
|
112
|
+
* Every piece of text the charts draw, keyed by what it means rather than where
|
|
113
|
+
* it appears, so a word used in two places is changed once.
|
|
114
|
+
*
|
|
115
|
+
* The defaults are SHAP 0.49.1's own wording: a chart given no labels reads the
|
|
116
|
+
* way SHAP's figures do.
|
|
117
|
+
*/
|
|
118
|
+
type PlotLabels = {
|
|
119
|
+
/** The value itself, as the beeswarm tooltip names it. */
|
|
120
|
+
shapValue: string;
|
|
121
|
+
/** The axis that measures it: beeswarm x axis and heatmap colour bar (_labels.py VALUE). */
|
|
122
|
+
shapValueAxis: string;
|
|
123
|
+
/** The bar chart's x axis. */
|
|
124
|
+
meanAbsShapValue: string;
|
|
125
|
+
/** A Feature's input value: beeswarm tooltip and colour bar title. */
|
|
126
|
+
featureValue: string;
|
|
127
|
+
/** The low end of the beeswarm colour bar. */
|
|
128
|
+
featureValueLow: string;
|
|
129
|
+
/** The high end of the beeswarm colour bar. */
|
|
130
|
+
featureValueHigh: string;
|
|
131
|
+
/** Written in place of a Feature value the payload does not have. */
|
|
132
|
+
missingFeatureValue: string;
|
|
133
|
+
/** The heatmap's Sample axis. */
|
|
134
|
+
samples: string;
|
|
135
|
+
/** A Sample's summed SHAP values, in the heatmap tooltip. */
|
|
136
|
+
sampleTotal: string;
|
|
137
|
+
/** A Sample the payload gives no label, numbered from 1. */
|
|
138
|
+
sampleFallback: (sampleNumber: number) => string;
|
|
139
|
+
/** The waterfall's starting point, E[f(X)]. */
|
|
140
|
+
baseValue: string;
|
|
141
|
+
/** The waterfall's end point, f(x). */
|
|
142
|
+
modelOutput: string;
|
|
143
|
+
/**
|
|
144
|
+
* The row standing in for every Feature not shown. `style` is "sum" for the
|
|
145
|
+
* bar, beeswarm and heatmap row in faithfulOtherRow mode, which SHAP titles as
|
|
146
|
+
* a sum, and "count" everywhere else.
|
|
147
|
+
*/
|
|
148
|
+
otherFeatures: (count: number, style: "sum" | "count") => string;
|
|
149
|
+
};
|
|
150
|
+
declare const shapLabels: PlotLabels;
|
|
151
|
+
/** The given wording over SHAP's. A key given as undefined keeps the default. */
|
|
152
|
+
declare function resolveLabels(labels?: Partial<PlotLabels>): PlotLabels;
|
|
153
|
+
|
|
154
|
+
export { type DisplayRows as D, type Explanation as E, InvalidExplanationError as I, type ParsedExplanation as P, type RowSort as R, UnsupportedContractVersionError as U, type ValuePrecision as V, type PlotLabels as a, type DisplayRow as b, formatLevel as c, formatShapValue as d, sortDisplayRows as e, formatFeatureLabel as f, resolveLabels as r, shapLabels as s };
|