Spaces:
Sleeping
Sleeping
add explanation
Browse files- .idea/workspace.xml +1 -3
- pages/Anchors.py +4 -2
.idea/workspace.xml
CHANGED
@@ -2,10 +2,8 @@
|
|
2 |
<project version="4">
|
3 |
<component name="ChangeListManager">
|
4 |
<list default="true" id="d4d4c856-4e4e-4d5f-b4ca-4c1c8515b14a" name="Default Changelist" comment="">
|
5 |
-
<change afterPath="$PROJECT_DIR$/pages/Anchors.py" afterDir="false" />
|
6 |
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
7 |
-
<change beforePath="$PROJECT_DIR$/pages/
|
8 |
-
<change beforePath="$PROJECT_DIR$/src/prompt_config.py" beforeDir="false" afterPath="$PROJECT_DIR$/src/prompt_config.py" afterDir="false" />
|
9 |
</list>
|
10 |
<option name="SHOW_DIALOG" value="false" />
|
11 |
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
|
|
2 |
<project version="4">
|
3 |
<component name="ChangeListManager">
|
4 |
<list default="true" id="d4d4c856-4e4e-4d5f-b4ca-4c1c8515b14a" name="Default Changelist" comment="">
|
|
|
5 |
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
6 |
+
<change beforePath="$PROJECT_DIR$/pages/Anchors.py" beforeDir="false" afterPath="$PROJECT_DIR$/pages/Anchors.py" afterDir="false" />
|
|
|
7 |
</list>
|
8 |
<option name="SHOW_DIALOG" value="false" />
|
9 |
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
pages/Anchors.py
CHANGED
@@ -97,7 +97,9 @@ def explain_example(anchors_threshold, example_idx):
|
|
97 |
"Coverage": [f"{exp.coverage():.2f}"] * len(exp.names())
|
98 |
}
|
99 |
df_explanation = pd.DataFrame(explanation_data)
|
100 |
-
|
|
|
|
|
101 |
st.table(df_explanation)
|
102 |
|
103 |
|
@@ -121,7 +123,7 @@ def main():
|
|
121 |
label="Select the sample index to explain:",
|
122 |
min_value=0,
|
123 |
max_value=len(X_test) - 1, # Ensures the index is within range
|
124 |
-
value=
|
125 |
step=1, # Step size
|
126 |
help=prompt_params.EXAMPLE_BE_EXPLAINED_IDX,
|
127 |
)
|
|
|
97 |
"Coverage": [f"{exp.coverage():.2f}"] * len(exp.names())
|
98 |
}
|
99 |
df_explanation = pd.DataFrame(explanation_data)
|
100 |
+
Prediction = explainer.class_names[global_model.predict(X_test.values[example_idx].reshape(1, -1))[0]]
|
101 |
+
st.write(f"### 🔍 The prediction of No. {example_idx} example is: **{Prediction}**")
|
102 |
+
st.write("### 📌 Explanation Rules for this example:")
|
103 |
st.table(df_explanation)
|
104 |
|
105 |
|
|
|
123 |
label="Select the sample index to explain:",
|
124 |
min_value=0,
|
125 |
max_value=len(X_test) - 1, # Ensures the index is within range
|
126 |
+
value=100, # Default value
|
127 |
step=1, # Step size
|
128 |
help=prompt_params.EXAMPLE_BE_EXPLAINED_IDX,
|
129 |
)
|