Nguyễn Thành Đạt commited on
Commit ·
19bd631
1
Parent(s): 036e7c4
updateGUI
Browse files
app.py
CHANGED
|
@@ -174,19 +174,26 @@ if uploaded_file is not None:
|
|
| 174 |
|
| 175 |
|
| 176 |
exp_html = exp.as_html()
|
| 177 |
-
|
| 178 |
-
|
| 179 |
-
|
| 180 |
-
|
| 181 |
-
|
| 182 |
-
|
| 183 |
-
|
| 184 |
-
|
| 185 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 186 |
|
| 187 |
-
|
| 188 |
|
| 189 |
-
|
| 190 |
-
|
| 191 |
-
|
| 192 |
|
|
|
|
| 174 |
|
| 175 |
|
| 176 |
exp_html = exp.as_html()
|
| 177 |
+
full_html = exp_html + """
|
| 178 |
+
<style>
|
| 179 |
+
div[class="lime explanation"] { display: none; } /* This targets the tree section */
|
| 180 |
+
.lime.table_div {overflow-x: hidden}
|
| 181 |
+
</style>
|
| 182 |
+
"""
|
| 183 |
+
components.html(full_html, height=320, width=None, scrolling=True)
|
| 184 |
+
|
| 185 |
+
|
| 186 |
+
def extract_explain(exp, label):
|
| 187 |
+
ans = exp.local_exp[label]
|
| 188 |
+
ans = [(exp.domain_mapper.feature_names[x[0]],
|
| 189 |
+
exp.domain_mapper.feature_values[x[0]],
|
| 190 |
+
exp.domain_mapper.discretized_feature_names[x[0]],
|
| 191 |
+
float(x[1])
|
| 192 |
+
) for x in ans]
|
| 193 |
|
| 194 |
+
return ans
|
| 195 |
|
| 196 |
+
explanation_list = extract_explain(exp, predicted)
|
| 197 |
+
explanation_df = pd.DataFrame(explanation_list, columns=['Feature', 'Value', 'Explain', 'Weight'])
|
| 198 |
+
st.table(explanation_df)
|
| 199 |
|