Skip to content

Commit 9cc8df3

Browse files
committed
fix tests
1 parent 9813be8 commit 9cc8df3

File tree

6 files changed

+70
-73
lines changed

6 files changed

+70
-73
lines changed

src/xaiflow/templates/assets/bundle.js

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/xaiflow/templates/assets/bundle.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 56 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,37 @@
11
<script lang="ts">
22
import ImportanceChart2 from './ImportanceChart2.svelte';
33
import ScatterShapValues from './ScatterShapValues.svelte';
4+
import DeepDiveManager from './DeepDiveManager.svelte';
45
56
// Props using Svelte 5 runes
67
interface Props {
78
importanceData: { feature_name: string; importance: number }[];
89
shapValues: number[][];
910
featureValues: number[][];
1011
featureEncodings?: { [key: string]: any }[]; // For feature value mapping
12+
baseValues: number[] | number; // Base values for SHAP calculations
13+
featureNames?: string[]; // Optional prop for feature names
14+
isHigherOutputBetter?: boolean; // Optional prop to determine if higher output is better
1115
}
1216
13-
let { importanceData, shapValues, featureValues, featureEncodings = {} }: Props = $props();
17+
let { importanceData,
18+
shapValues,
19+
featureValues,
20+
featureEncodings = {},
21+
baseValues,
22+
featureNames,
23+
isHigherOutputBetter,
24+
}: Props = $props();
1425
1526
// Reactive state for selected label using $state
1627
let selectedLabel: string | null = $state(null);
28+
let showDeepDive = $state(false);
1729
1830
console.log("ChartManager", importanceData);
1931
console.log('ChartManager: 1/4 command in file');
20-
let featureNames = $derived(
21-
importanceData.map(item => item.feature_name)
22-
);
32+
// let featureNames = $derived(
33+
// importanceData.map(item => item.feature_name)
34+
// );
2335
console.log('ChartManager: 2/4 command in file');
2436
2537
console.log('ChartManager: called');
@@ -42,31 +54,47 @@
4254
</script>
4355

4456
<div class="chart-manager">
45-
<div class="charts-row">
46-
<div class="chart-section">
47-
<h3>Feature Importance Chart</h3>
48-
<div class="chart-container">
49-
<ImportanceChart2
50-
data={importanceData}
51-
bind:selectedLabel={selectedLabel}
52-
on:labelSelected={handleLabelSelection}
53-
/>
57+
<div style="display: flex; gap: 1.5rem; align-items: center; margin-bottom: 1.5rem;">
58+
<button type="button" on:click={() => showDeepDive = false} class:selected={!showDeepDive}>Charts</button>
59+
<button id="deepdive-button" type="button" on:click={() => showDeepDive = true} class:selected={showDeepDive}>Deep Dive</button>
60+
</div>
61+
{#if !showDeepDive}
62+
<div class="charts-row">
63+
<div class="chart-section">
64+
<h3>Feature Importance Chart</h3>
65+
<div class="chart-container">
66+
<ImportanceChart2
67+
data={importanceData}
68+
bind:selectedLabel={selectedLabel}
69+
on:labelSelected={handleLabelSelection}
70+
/>
71+
</div>
5472
</div>
55-
</div>
56-
57-
<div class="chart-section">
58-
<h3>SHAP Values</h3>
59-
<div class="chart-container">
60-
<ScatterShapValues
61-
shapValues={shapValues}
62-
featureValues={featureValues}
63-
bind:selectedFeatureIndex={selectedFeatureIndex}
64-
selectedFeature={selectedLabel}
65-
bind:selectedLabel={selectedLabel}
66-
isHigherOutputBetter={true}
67-
featureEncodings={featureEncodings}
68-
/>
73+
74+
<div class="chart-section">
75+
<h3>SHAP Values</h3>
76+
<div class="chart-container">
77+
<ScatterShapValues
78+
shapValues={shapValues}
79+
featureValues={featureValues}
80+
bind:selectedFeatureIndex={selectedFeatureIndex}
81+
bind:selectedFeature={selectedLabel}
82+
isHigherOutputBetter={true}
83+
featureEncodings={featureEncodings}
84+
/>
85+
</div>
6986
</div>
7087
</div>
71-
</div>
88+
{:else}
89+
<DeepDiveManager
90+
shapValues={shapValues}
91+
featureValues={featureValues}
92+
selectedFeatureIndex={selectedFeatureIndex}
93+
selectedFeature={selectedLabel}
94+
baseValues={baseValues}
95+
featureEncodings={featureEncodings}
96+
isHigherOutputBetter={true}
97+
featureNames={featureNames}
98+
/>
99+
{/if}
72100
</div>

src/xaiflow/templates/components/ScatterShapValues.svelte

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717
1818
let { shapValues,
1919
featureValues,
20-
selectedFeatureIndex,
21-
selectedFeature,
20+
selectedFeatureIndex = $bindable(),
21+
selectedFeature = $bindable(),
2222
featureEncodings=[{}],
2323
isHigherOutputBetter=false }: Props = $props();
2424
let chart: Chart | undefined = $state();

src/xaiflow/templates/report.html

Lines changed: 4 additions & 37 deletions
Large diffs are not rendered by default.

tests/test_mlflow_plugin.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,9 @@ def html_content_click_test(html_path: str):
7272
}
7373
""")
7474
assert not is_empty, "Canvas is empty or nearly empty: 99% of pixels have the same color"
75-
75+
# click "deepdive-button"
76+
page.wait_for_selector("#deepdive-button")
77+
page.click("#deepdive-button")
7678
# --- NEW: Check canvas by id 'deepdive-canvas' and get unique colors ---
7779
page.wait_for_selector("#deepdive-canvas")
7880
deepdive_canvas = page.query_selector("#deepdive-canvas")

0 commit comments

Comments
 (0)