dotdata_widgets 0.1.0 → 0.1.1
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 +19 -7
- package/css/colors.css +120 -0
- package/css/typography.css +35 -0
- package/css/widget.css +53 -3
- package/dist/index.js +2 -2
- package/lib/components/accordion/Accordion.js +18 -0
- package/lib/components/accordion/index.js +1 -0
- package/lib/components/input/index.js +1 -0
- package/lib/components/input/input.js +6 -0
- package/lib/extension.js +1 -14
- package/lib/feature-descriptor/feature-details/FeatureCorrelatedFeaturesTable.js +14 -0
- package/lib/feature-descriptor/feature-details/FeatureDistributionChart.js +190 -0
- package/lib/feature-descriptor/feature-details/FeatureStatisticsTable.js +36 -0
- package/lib/feature-descriptor/feature-details/index.js +3 -0
- package/lib/feature-descriptor/feature-explanation/FeatureExplanation.js +40 -0
- package/lib/feature-descriptor/feature-explanation/components/ColoredExplanationBlock.js +28 -0
- package/lib/feature-descriptor/feature-explanation/components/ColumnExplanationBlock.js +4 -0
- package/lib/feature-descriptor/feature-explanation/components/DataSlotExplanationBlock.js +4 -0
- package/lib/feature-descriptor/feature-explanation/components/PetExplanationBlock.js +3 -0
- package/lib/feature-descriptor/feature-explanation/components/TextExplanationBlock.js +2 -0
- package/lib/feature-descriptor/feature-explanation/components/TextWithDataSlotContextExplanationBlock.js +2 -0
- package/lib/feature-descriptor/feature-explanation/components/TopicExplanationBlock.js +2 -0
- package/lib/feature-descriptor/feature-explanation/components/UnknownExplanationBlock.js +2 -0
- package/lib/feature-descriptors-domain/exploration-path/exploration-path-header.js +13 -0
- package/lib/feature-descriptors-domain/exploration-path/exploration-path-join-list.js +8 -0
- package/lib/feature-descriptors-domain/exploration-path/index.js +2 -0
- package/lib/feature-descriptors-domain/grouped-domains-descriptions-list.js +47 -0
- package/lib/index.js +2 -15
- package/lib/models/column/column.js +1 -0
- package/lib/models/column/index.js +1 -0
- package/lib/models/feature/feature-histogram.js +16 -0
- package/lib/models/feature/feature-leaderboard.js +1 -0
- package/lib/models/feature/feature.js +12 -0
- package/lib/models/feature/index.js +2 -0
- package/lib/models/feature-descriptors-domain/fd-domain-description.js +1 -0
- package/lib/models/feature-descriptors-domain/fd-grouped-domain-descriptions.js +1 -0
- package/lib/models/feature-descriptors-domain/index.js +2 -0
- package/lib/models/feature-explanation/feature-explanation.model.js +26 -0
- package/lib/models/feature-explanation/index.js +1 -0
- package/lib/models/feature-leaderboard/feature-leaderboard.js +1 -0
- package/lib/models/feature-leaderboard/index.js +1 -0
- package/lib/models/feature-space/feature-space.js +1 -0
- package/lib/models/feature-space/index.js +1 -0
- package/lib/models/index.js +1 -0
- package/lib/plugin.js +7 -29
- package/lib/utils/asserations.js +5 -0
- package/lib/utils/index.js +3 -0
- package/lib/utils/localize.js +14 -0
- package/lib/utils/object/extract-property.js +6 -0
- package/lib/utils/object/index.js +2 -0
- package/lib/utils/object/is-set.js +6 -0
- package/lib/version.js +2 -6
- package/lib/widgets/FeatureLeaderboardWidget.js +63 -0
- package/lib/widgets/FeatureSpaceWidget.js +50 -0
- package/lib/widgets/feature-leaderboard/FeatureLeaderboardEntries.js +10 -0
- package/lib/widgets/feature-leaderboard/FeatureLeaderboardOverview.js +20 -0
- package/lib/widgets/feature-leaderboard/FeatureLeaderboardView.js +19 -0
- package/lib/widgets/feature-leaderboard/entry-item/FeatureLeaderboardEntryDetails.js +15 -0
- package/lib/widgets/feature-leaderboard/entry-item/FeatureLeaderboardEntryItem.js +20 -0
- package/lib/widgets/feature-space/FeatureExplorationPaths.js +37 -0
- package/lib/widgets/feature-space/FeatureSpaceDomainsDescriptions.js +53 -0
- package/lib/widgets/feature-space/FeatureSpaceView.js +9 -0
- package/lib/widgets/index.js +4 -0
- package/package.json +60 -37
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
3
|
+
export const AccordionHeader = ({ children, }) => React.createElement(React.Fragment, null, children);
|
|
4
|
+
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
5
|
+
export const AccordionDetails = ({ children, }) => React.createElement(React.Fragment, null, children);
|
|
6
|
+
export const Accordion = ({ children, expandedDetailsStyle, collapsedDetailsStyle, expandedHeaderStyle, collapsedHeaderStyle, toggleStyle, initialState, }) => {
|
|
7
|
+
const [isExpanded, setIsExpanded] = useState(() => initialState ?? false);
|
|
8
|
+
const components = React.Children.toArray(children).filter(React.isValidElement);
|
|
9
|
+
const Header = components.find(child => child.type?.name === AccordionHeader.name);
|
|
10
|
+
const Details = components.find(child => child.type?.name === AccordionDetails.name);
|
|
11
|
+
return (React.createElement("div", { className: `dotdata-accordion ${isExpanded
|
|
12
|
+
? 'dotdata-accordion-expanded'
|
|
13
|
+
: 'dotdata-accordion-collapsed'}` },
|
|
14
|
+
React.createElement("div", { style: isExpanded ? expandedHeaderStyle : collapsedHeaderStyle, className: "dotdata-accordion-header" },
|
|
15
|
+
React.createElement("div", { className: `dotdata-accordion-header-toggle ${isExpanded ? 'expanded' : ''}`, style: toggleStyle, onClick: () => setIsExpanded(!isExpanded) }, "\u25B6"),
|
|
16
|
+
Header),
|
|
17
|
+
isExpanded && (React.createElement("div", { style: isExpanded ? expandedDetailsStyle : collapsedDetailsStyle, className: "dotdata-accordion-details" }, Details))));
|
|
18
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './Accordion';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './input';
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export function Input(props) {
|
|
3
|
+
const { onValueChange, inputSize, ...restProps } = props;
|
|
4
|
+
const isSmall = inputSize === 'small';
|
|
5
|
+
return (React.createElement("input", { type: "text", ...restProps, className: `dd-input ${restProps.className ?? ''} ${isSmall ? 'small' : ''}`, onChange: event => onValueChange(event.target.value) }));
|
|
6
|
+
}
|
package/lib/extension.js
CHANGED
|
@@ -1,17 +1,5 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
// Copyright (c) Jupyter Development Team.
|
|
3
2
|
// Distributed under the terms of the Modified BSD License.
|
|
4
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
5
|
-
if (k2 === undefined) k2 = k;
|
|
6
|
-
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
7
|
-
}) : (function(o, m, k, k2) {
|
|
8
|
-
if (k2 === undefined) k2 = k;
|
|
9
|
-
o[k2] = m[k];
|
|
10
|
-
}));
|
|
11
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
12
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
13
|
-
};
|
|
14
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
3
|
// Entry point for the notebook bundle containing custom model definitions.
|
|
16
4
|
//
|
|
17
5
|
// Setup notebook base URL
|
|
@@ -23,5 +11,4 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
23
11
|
window.__webpack_public_path__ =
|
|
24
12
|
document.querySelector('body').getAttribute('data-base-url') +
|
|
25
13
|
'nbextensions/dotdata_widgets';
|
|
26
|
-
|
|
27
|
-
//# sourceMappingURL=extension.js.map
|
|
14
|
+
export * from './index';
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { FeatureExplanation } from '../feature-explanation/FeatureExplanation';
|
|
3
|
+
import { Localize } from '../../utils';
|
|
4
|
+
export const FeatureCorrelatedFeaturesTable = ({ correlatedFeatures }) => {
|
|
5
|
+
return (React.createElement("table", { className: "table", style: { width: '100%' } },
|
|
6
|
+
React.createElement("tr", null,
|
|
7
|
+
React.createElement("th", { className: "label-bold" }, "Name"),
|
|
8
|
+
React.createElement("th", { className: "label-bold" }, "Correlation"),
|
|
9
|
+
React.createElement("th", { className: "label-bold" }, "Explanation")),
|
|
10
|
+
correlatedFeatures.map(([{ id, explanation }, correlation]) => (React.createElement("tr", null,
|
|
11
|
+
React.createElement("td", null, id),
|
|
12
|
+
React.createElement("td", null, Localize.formatNumber(correlation)),
|
|
13
|
+
React.createElement("td", null, React.createElement(FeatureExplanation, { explanationBlocks: explanation.tokens })))))));
|
|
14
|
+
};
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
import React, { useEffect } from 'react';
|
|
2
|
+
import * as vega from 'vega';
|
|
3
|
+
import { ContinuousHistogram, } from '../../models/feature';
|
|
4
|
+
export const FeatureDistributionChart = ({ histogram }) => {
|
|
5
|
+
const elemRef = React.useRef(null);
|
|
6
|
+
useEffect(() => {
|
|
7
|
+
if (!elemRef.current) {
|
|
8
|
+
return;
|
|
9
|
+
}
|
|
10
|
+
const histogramSpec = ContinuousHistogram.isTypeOf(histogram)
|
|
11
|
+
? createContinuousHistogramSpec(histogram)
|
|
12
|
+
: createDiscreteHistogramSpec(histogram);
|
|
13
|
+
const view = new vega.View(vega.parse({
|
|
14
|
+
width: elemRef.current.clientWidth,
|
|
15
|
+
height: 140,
|
|
16
|
+
padding: 5,
|
|
17
|
+
...histogramSpec,
|
|
18
|
+
}), {
|
|
19
|
+
renderer: 'canvas',
|
|
20
|
+
hover: true,
|
|
21
|
+
container: elemRef.current,
|
|
22
|
+
});
|
|
23
|
+
view.runAsync();
|
|
24
|
+
}, [elemRef]);
|
|
25
|
+
return React.createElement("div", { ref: elemRef });
|
|
26
|
+
};
|
|
27
|
+
function createContinuousHistogramSpec(histogram) {
|
|
28
|
+
return {
|
|
29
|
+
signals: [
|
|
30
|
+
{
|
|
31
|
+
name: 'tooltip',
|
|
32
|
+
value: {},
|
|
33
|
+
on: [
|
|
34
|
+
{ events: 'rect:mouseover', update: 'datum' },
|
|
35
|
+
{ events: 'rect:mouseout', update: '{}' },
|
|
36
|
+
],
|
|
37
|
+
},
|
|
38
|
+
],
|
|
39
|
+
data: [
|
|
40
|
+
{
|
|
41
|
+
name: 'table',
|
|
42
|
+
values: histogram.bins,
|
|
43
|
+
},
|
|
44
|
+
],
|
|
45
|
+
scales: [
|
|
46
|
+
{
|
|
47
|
+
name: 'xscale',
|
|
48
|
+
type: 'linear',
|
|
49
|
+
domain: {
|
|
50
|
+
fields: [
|
|
51
|
+
{ data: 'table', field: 'l' },
|
|
52
|
+
{ data: 'table', field: 'u' },
|
|
53
|
+
],
|
|
54
|
+
},
|
|
55
|
+
range: 'width',
|
|
56
|
+
nice: true,
|
|
57
|
+
round: true,
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
name: 'yscale',
|
|
61
|
+
domain: { data: 'table', field: 'frequency' },
|
|
62
|
+
nice: true,
|
|
63
|
+
range: 'height',
|
|
64
|
+
},
|
|
65
|
+
],
|
|
66
|
+
axes: [
|
|
67
|
+
{
|
|
68
|
+
orient: 'bottom',
|
|
69
|
+
scale: 'xscale',
|
|
70
|
+
labelOverlap: 'parity',
|
|
71
|
+
},
|
|
72
|
+
{ orient: 'left', scale: 'yscale' },
|
|
73
|
+
],
|
|
74
|
+
marks: [
|
|
75
|
+
{
|
|
76
|
+
type: 'rect',
|
|
77
|
+
from: { data: 'table' },
|
|
78
|
+
encode: {
|
|
79
|
+
enter: {
|
|
80
|
+
x: { scale: 'xscale', field: 'l' },
|
|
81
|
+
x2: { scale: 'xscale', field: 'u' },
|
|
82
|
+
y: { scale: 'yscale', field: 'frequency' },
|
|
83
|
+
y2: { scale: 'yscale', value: 0 },
|
|
84
|
+
},
|
|
85
|
+
update: {
|
|
86
|
+
fill: { value: '#1976d2' },
|
|
87
|
+
},
|
|
88
|
+
},
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
type: 'text',
|
|
92
|
+
encode: {
|
|
93
|
+
enter: {
|
|
94
|
+
align: { value: 'center' },
|
|
95
|
+
baseline: { value: 'bottom' },
|
|
96
|
+
fill: { value: '#333' },
|
|
97
|
+
},
|
|
98
|
+
update: {
|
|
99
|
+
x: {
|
|
100
|
+
scale: 'xscale',
|
|
101
|
+
signal: '(tooltip.u + tooltip.l) / 2',
|
|
102
|
+
band: 0.5,
|
|
103
|
+
},
|
|
104
|
+
y: { scale: 'yscale', signal: 'tooltip.frequency', offset: -2 },
|
|
105
|
+
text: { signal: 'tooltip.frequency' },
|
|
106
|
+
fillOpacity: [
|
|
107
|
+
{ test: 'datum === tooltip', value: 0 },
|
|
108
|
+
{ value: 1 },
|
|
109
|
+
],
|
|
110
|
+
},
|
|
111
|
+
},
|
|
112
|
+
},
|
|
113
|
+
],
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
function createDiscreteHistogramSpec(histogram) {
|
|
117
|
+
return {
|
|
118
|
+
signals: [
|
|
119
|
+
{
|
|
120
|
+
name: 'tooltip',
|
|
121
|
+
value: {},
|
|
122
|
+
on: [
|
|
123
|
+
{ events: 'rect:mouseover', update: 'datum' },
|
|
124
|
+
{ events: 'rect:mouseout', update: '{}' },
|
|
125
|
+
],
|
|
126
|
+
},
|
|
127
|
+
],
|
|
128
|
+
data: [
|
|
129
|
+
{
|
|
130
|
+
name: 'table',
|
|
131
|
+
values: histogram.bins,
|
|
132
|
+
},
|
|
133
|
+
],
|
|
134
|
+
scales: [
|
|
135
|
+
{
|
|
136
|
+
name: 'xscale',
|
|
137
|
+
type: 'band',
|
|
138
|
+
domain: { data: 'table', field: 'label' },
|
|
139
|
+
range: 'width',
|
|
140
|
+
round: true,
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
name: 'yscale',
|
|
144
|
+
domain: { data: 'table', field: 'frequency' },
|
|
145
|
+
nice: true,
|
|
146
|
+
range: 'height',
|
|
147
|
+
},
|
|
148
|
+
],
|
|
149
|
+
axes: [
|
|
150
|
+
{ orient: 'bottom', scale: 'xscale', labelOverlap: 'parity' },
|
|
151
|
+
{ orient: 'left', scale: 'yscale' },
|
|
152
|
+
],
|
|
153
|
+
marks: [
|
|
154
|
+
{
|
|
155
|
+
type: 'rect',
|
|
156
|
+
from: { data: 'table' },
|
|
157
|
+
encode: {
|
|
158
|
+
enter: {
|
|
159
|
+
x: { scale: 'xscale', field: 'label' },
|
|
160
|
+
width: { scale: 'xscale', band: 1 },
|
|
161
|
+
y: { scale: 'yscale', field: 'frequency' },
|
|
162
|
+
y2: { scale: 'yscale', value: 0 },
|
|
163
|
+
},
|
|
164
|
+
update: {
|
|
165
|
+
fill: { value: '#1976d2' },
|
|
166
|
+
},
|
|
167
|
+
},
|
|
168
|
+
},
|
|
169
|
+
{
|
|
170
|
+
type: 'text',
|
|
171
|
+
encode: {
|
|
172
|
+
enter: {
|
|
173
|
+
align: { value: 'center' },
|
|
174
|
+
baseline: { value: 'bottom' },
|
|
175
|
+
fill: { value: '#333' },
|
|
176
|
+
},
|
|
177
|
+
update: {
|
|
178
|
+
x: { scale: 'xscale', signal: 'tooltip.label', band: 0.5 },
|
|
179
|
+
y: { scale: 'yscale', signal: 'tooltip.frequency', offset: -2 },
|
|
180
|
+
text: { signal: 'tooltip.frequency' },
|
|
181
|
+
fillOpacity: [
|
|
182
|
+
{ test: 'datum === tooltip', value: 0 },
|
|
183
|
+
{ value: 1 },
|
|
184
|
+
],
|
|
185
|
+
},
|
|
186
|
+
},
|
|
187
|
+
},
|
|
188
|
+
],
|
|
189
|
+
};
|
|
190
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { FeatureMetric } from '../../models/feature';
|
|
3
|
+
import { Localize } from '../../utils';
|
|
4
|
+
const metricRowStyle = {
|
|
5
|
+
borderTop: '1px solid var(--c-grey-100)',
|
|
6
|
+
display: 'flex',
|
|
7
|
+
justifyContent: 'space-between',
|
|
8
|
+
alignItems: 'center',
|
|
9
|
+
paddingInlineEnd: '50px',
|
|
10
|
+
height: '30px',
|
|
11
|
+
};
|
|
12
|
+
const metricNameStyle = {
|
|
13
|
+
textTransform: 'capitalize',
|
|
14
|
+
};
|
|
15
|
+
const statsOrder = [
|
|
16
|
+
FeatureMetric.Min,
|
|
17
|
+
FeatureMetric.Max,
|
|
18
|
+
FeatureMetric.Mean,
|
|
19
|
+
FeatureMetric.Stddev,
|
|
20
|
+
FeatureMetric.Count,
|
|
21
|
+
FeatureMetric.NullRatio,
|
|
22
|
+
FeatureMetric.ZerosRatio,
|
|
23
|
+
FeatureMetric.Correlation,
|
|
24
|
+
FeatureMetric.FeatureAUC,
|
|
25
|
+
];
|
|
26
|
+
export const FeatureStatisticsTable = ({ statistics }) => {
|
|
27
|
+
return (React.createElement("div", { style: { columnCount: 2, columnFill: 'balance', columnGap: '60px' } }, Object.entries(statistics)
|
|
28
|
+
.sort(sortStatsByName)
|
|
29
|
+
.map(([metricName, metricValue]) => (React.createElement("div", { key: metricName, style: metricRowStyle },
|
|
30
|
+
React.createElement("span", { className: "label-bold", style: metricNameStyle }, metricName),
|
|
31
|
+
' ',
|
|
32
|
+
React.createElement("span", null, Localize.formatNumber(metricValue, '-')))))));
|
|
33
|
+
};
|
|
34
|
+
function sortStatsByName(a, b) {
|
|
35
|
+
return statsOrder.indexOf(a[0]) - statsOrder.indexOf(b[0]);
|
|
36
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { FeatureExplanationBlock } from '../../models/feature-explanation';
|
|
3
|
+
import { TextExplanationBlock } from './components/TextExplanationBlock';
|
|
4
|
+
import { ColumnExplanationBlock } from './components/ColumnExplanationBlock';
|
|
5
|
+
import { PetExplanationBlock } from './components/PetExplanationBlock';
|
|
6
|
+
import { DataSlotExplanationBlock } from './components/DataSlotExplanationBlock';
|
|
7
|
+
import { TopicExplanationBlock } from './components/TopicExplanationBlock';
|
|
8
|
+
import { TextWithDataSlotContextExplanationBlock } from './components/TextWithDataSlotContextExplanationBlock';
|
|
9
|
+
import { UnknownExplanationBlock } from './components/UnknownExplanationBlock';
|
|
10
|
+
export const FeatureExplanation = ({ explanationBlocks, }) => {
|
|
11
|
+
return (React.createElement("div", { style: { display: 'flex' } }, explanationBlocks.map(block => {
|
|
12
|
+
if (FeatureExplanationBlock.isTextExplanationBlock(block)) {
|
|
13
|
+
return React.createElement(TextExplanationBlock, { ...block });
|
|
14
|
+
}
|
|
15
|
+
else if (FeatureExplanationBlock.isColumnExplanationBlock(block)) {
|
|
16
|
+
return React.createElement(ColumnExplanationBlock, { ...block });
|
|
17
|
+
}
|
|
18
|
+
else if (FeatureExplanationBlock.isDataSlotExplanationBlock(block)) {
|
|
19
|
+
return React.createElement(DataSlotExplanationBlock, { ...block });
|
|
20
|
+
}
|
|
21
|
+
else if (FeatureExplanationBlock.isPetExplanationBlock(block)) {
|
|
22
|
+
return React.createElement(PetExplanationBlock, { ...block });
|
|
23
|
+
}
|
|
24
|
+
else if (FeatureExplanationBlock.isTextWithDataSlotContextExplanationBlock(block)) {
|
|
25
|
+
return React.createElement(TextWithDataSlotContextExplanationBlock, { ...block });
|
|
26
|
+
}
|
|
27
|
+
else if (FeatureExplanationBlock.isTopicExplanationBlock(block)) {
|
|
28
|
+
return React.createElement(TopicExplanationBlock, { ...block });
|
|
29
|
+
}
|
|
30
|
+
else if (FeatureExplanationBlock.isOperatorExplanationBlock(block)) {
|
|
31
|
+
return (React.createElement(FeatureExplanation, { explanationBlocks: block.tokens.map(token => ({
|
|
32
|
+
...token,
|
|
33
|
+
pathType: block.type,
|
|
34
|
+
})) }));
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
return React.createElement(UnknownExplanationBlock, { ...block });
|
|
38
|
+
}
|
|
39
|
+
})));
|
|
40
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { FeatureExplanationBlock } from '../../../models/feature-explanation';
|
|
3
|
+
export const ColoredExplanationBlock = ({ block, children }) => {
|
|
4
|
+
let color = 'revert';
|
|
5
|
+
let fontWeight = '400';
|
|
6
|
+
if (block.type === FeatureExplanationBlock.Type.DataSlot) {
|
|
7
|
+
color = 'var(--c-blue-700)';
|
|
8
|
+
fontWeight = '500';
|
|
9
|
+
}
|
|
10
|
+
else if (block.type === FeatureExplanationBlock.Type.Column ||
|
|
11
|
+
block.type === FeatureExplanationBlock.Type.PredictionExecutionTime) {
|
|
12
|
+
const pathType = block.pathType;
|
|
13
|
+
if ([
|
|
14
|
+
FeatureExplanationBlock.Type.Filter,
|
|
15
|
+
FeatureExplanationBlock.Type.Reduce,
|
|
16
|
+
].includes(pathType)) {
|
|
17
|
+
color = 'var(--c-blue-700)';
|
|
18
|
+
fontWeight = '500';
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
return (React.createElement("span", { style: {
|
|
22
|
+
color: color,
|
|
23
|
+
fontWeight,
|
|
24
|
+
display: 'inline-block',
|
|
25
|
+
wordBreak: 'break-word',
|
|
26
|
+
whiteSpace: 'pre',
|
|
27
|
+
} }, children));
|
|
28
|
+
};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ColoredExplanationBlock } from './ColoredExplanationBlock';
|
|
3
|
+
export const ColumnExplanationBlock = block => (React.createElement(ColoredExplanationBlock, { block: block },
|
|
4
|
+
React.createElement("span", { className: "column-name" }, block.columnName)));
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ColoredExplanationBlock } from './ColoredExplanationBlock';
|
|
3
|
+
export const DataSlotExplanationBlock = block => (React.createElement(ColoredExplanationBlock, { block: block },
|
|
4
|
+
React.createElement("span", { className: "sa-data-slot-name" }, block.dataSlotName)));
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export const ExplorationPathHeader = props => {
|
|
3
|
+
const { targetTable, sourceTable, targetColumns, sourceColumns } = props.explorationPath;
|
|
4
|
+
return (React.createElement("div", null,
|
|
5
|
+
React.createElement("span", null, targetTable),
|
|
6
|
+
"[",
|
|
7
|
+
React.createElement("span", null, targetColumns.join(', ')),
|
|
8
|
+
"]",
|
|
9
|
+
React.createElement("span", null, sourceTable),
|
|
10
|
+
"[",
|
|
11
|
+
React.createElement("span", null, sourceColumns.join(', ')),
|
|
12
|
+
"]"));
|
|
13
|
+
};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Accordion, AccordionDetails, AccordionHeader, } from '../components/accordion';
|
|
3
|
+
const listStyle = {
|
|
4
|
+
paddingLeft: 0,
|
|
5
|
+
listStyleType: 'none',
|
|
6
|
+
marginBlock: '0 4px',
|
|
7
|
+
};
|
|
8
|
+
const accordionStyle = {
|
|
9
|
+
border: 0,
|
|
10
|
+
paddingBlock: 0,
|
|
11
|
+
'--padding-inline': '20px',
|
|
12
|
+
};
|
|
13
|
+
const toggleStyle = {
|
|
14
|
+
left: '3px',
|
|
15
|
+
top: '10px',
|
|
16
|
+
};
|
|
17
|
+
const accordionProps = {
|
|
18
|
+
expandedDetailsStyle: accordionStyle,
|
|
19
|
+
collapsedDetailsStyle: accordionStyle,
|
|
20
|
+
expandedHeaderStyle: accordionStyle,
|
|
21
|
+
collapsedHeaderStyle: accordionStyle,
|
|
22
|
+
toggleStyle,
|
|
23
|
+
};
|
|
24
|
+
const ColumnDescriptions = props => {
|
|
25
|
+
const onlyOneDescription = props.column.descriptions.length === 1;
|
|
26
|
+
const firstDescription = props.column.descriptions[0];
|
|
27
|
+
return onlyOneDescription ? (React.createElement("div", null, firstDescription.description)) : (React.createElement("div", null,
|
|
28
|
+
React.createElement(Accordion, { ...accordionProps },
|
|
29
|
+
React.createElement(AccordionHeader, null,
|
|
30
|
+
React.createElement("div", null, props.column.summary)),
|
|
31
|
+
React.createElement(AccordionDetails, null,
|
|
32
|
+
React.createElement("ul", { style: listStyle }, props.column.descriptions.map(({ description }) => (React.createElement("li", { key: description }, description))))))));
|
|
33
|
+
};
|
|
34
|
+
const TypeColumns = props => {
|
|
35
|
+
const onlyOneColumn = props.type.columns.length === 1;
|
|
36
|
+
const firstColumn = props.type.columns[0];
|
|
37
|
+
return onlyOneColumn ? (React.createElement(ColumnDescriptions, { column: firstColumn })) : (React.createElement("div", null,
|
|
38
|
+
React.createElement(Accordion, { ...accordionProps },
|
|
39
|
+
React.createElement(AccordionHeader, null,
|
|
40
|
+
React.createElement("div", null, props.type.summary)),
|
|
41
|
+
React.createElement(AccordionDetails, null,
|
|
42
|
+
React.createElement("ul", { style: listStyle }, props.type.columns.map((column, idx) => (React.createElement("li", { key: idx }, React.createElement(ColumnDescriptions, { column: column })))))))));
|
|
43
|
+
};
|
|
44
|
+
export const GroupedDomainsDescriptionsList = props => {
|
|
45
|
+
const { types } = props.groupedDomain;
|
|
46
|
+
return (React.createElement(React.Fragment, null, types.map(type => (React.createElement(TypeColumns, { key: type.summary, type: type })))));
|
|
47
|
+
};
|
package/lib/index.js
CHANGED
|
@@ -1,17 +1,4 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
// Copyright (c) dotdata
|
|
3
2
|
// Distributed under the terms of the Modified BSD License.
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
7
|
-
}) : (function(o, m, k, k2) {
|
|
8
|
-
if (k2 === undefined) k2 = k;
|
|
9
|
-
o[k2] = m[k];
|
|
10
|
-
}));
|
|
11
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
12
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
13
|
-
};
|
|
14
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
__exportStar(require("./version"), exports);
|
|
16
|
-
__exportStar(require("./widget"), exports);
|
|
17
|
-
//# sourceMappingURL=index.js.map
|
|
3
|
+
export * from './version';
|
|
4
|
+
export * from './widgets';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './column';
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export var ContinuousHistogram;
|
|
2
|
+
(function (ContinuousHistogram) {
|
|
3
|
+
function isTypeOf(histogram) {
|
|
4
|
+
const bin = histogram.bins[0];
|
|
5
|
+
return bin && 'l' in bin && 'u' in bin;
|
|
6
|
+
}
|
|
7
|
+
ContinuousHistogram.isTypeOf = isTypeOf;
|
|
8
|
+
})(ContinuousHistogram || (ContinuousHistogram = {}));
|
|
9
|
+
export var DiscreteHistogram;
|
|
10
|
+
(function (DiscreteHistogram) {
|
|
11
|
+
function isTypeOf(histogram) {
|
|
12
|
+
const bin = histogram.bins[0];
|
|
13
|
+
return bin && 'label' in bin;
|
|
14
|
+
}
|
|
15
|
+
DiscreteHistogram.isTypeOf = isTypeOf;
|
|
16
|
+
})(DiscreteHistogram || (DiscreteHistogram = {}));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export var FeatureMetric;
|
|
2
|
+
(function (FeatureMetric) {
|
|
3
|
+
FeatureMetric["Min"] = "Min";
|
|
4
|
+
FeatureMetric["Max"] = "Max";
|
|
5
|
+
FeatureMetric["Mean"] = "Mean";
|
|
6
|
+
FeatureMetric["Stddev"] = "Stddev";
|
|
7
|
+
FeatureMetric["Count"] = "Count";
|
|
8
|
+
FeatureMetric["NullRatio"] = "Null ratio";
|
|
9
|
+
FeatureMetric["ZerosRatio"] = "Zeros ratio";
|
|
10
|
+
FeatureMetric["Correlation"] = "Correlation";
|
|
11
|
+
FeatureMetric["FeatureAUC"] = "Feature AUC";
|
|
12
|
+
})(FeatureMetric || (FeatureMetric = {}));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export var FeatureExplanationBlock;
|
|
2
|
+
(function (FeatureExplanationBlock) {
|
|
3
|
+
let Type;
|
|
4
|
+
(function (Type) {
|
|
5
|
+
Type["PredictionExecutionTime"] = "PetToken";
|
|
6
|
+
Type["DataSlot"] = "DataSlotToken";
|
|
7
|
+
Type["Text"] = "TextToken";
|
|
8
|
+
Type["Column"] = "ColumnToken";
|
|
9
|
+
Type["TargetColumn"] = "TargetColumnToken";
|
|
10
|
+
Type["Topic"] = "TopicToken";
|
|
11
|
+
Type["TextWithDataSlotContext"] = "textWithDataSlotContext";
|
|
12
|
+
Type["Map"] = "MapToken";
|
|
13
|
+
Type["Reduce"] = "ReduceToken";
|
|
14
|
+
Type["Filter"] = "FilterToken";
|
|
15
|
+
Type["TimeDiff"] = "TimeDiffToken";
|
|
16
|
+
Type["PeriodicTimeDiff"] = "PeriodicTimeDiffToken";
|
|
17
|
+
Type["DistanceMap"] = "DistanceMapToken";
|
|
18
|
+
})(Type = FeatureExplanationBlock.Type || (FeatureExplanationBlock.Type = {}));
|
|
19
|
+
FeatureExplanationBlock.isOperatorExplanationBlock = (block) => 'tokens' in block;
|
|
20
|
+
FeatureExplanationBlock.isTextExplanationBlock = (block) => Type.Text === block.type;
|
|
21
|
+
FeatureExplanationBlock.isColumnExplanationBlock = (block) => [Type.Column, Type.TargetColumn].includes(block.type);
|
|
22
|
+
FeatureExplanationBlock.isDataSlotExplanationBlock = (block) => Type.DataSlot === block.type;
|
|
23
|
+
FeatureExplanationBlock.isPetExplanationBlock = (block) => Type.PredictionExecutionTime === block.type;
|
|
24
|
+
FeatureExplanationBlock.isTopicExplanationBlock = (block) => Type.Topic === block.type;
|
|
25
|
+
FeatureExplanationBlock.isTextWithDataSlotContextExplanationBlock = (block) => Type.TextWithDataSlotContext === block.type;
|
|
26
|
+
})(FeatureExplanationBlock || (FeatureExplanationBlock = {}));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './feature-explanation.model';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './feature-leaderboard';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './feature-space';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|