explain
Browse files- app.py +28 -0
- requirements.txt +2 -0
app.py
CHANGED
@@ -101,6 +101,13 @@ learn = load_learner(p)
|
|
101 |
def like(issue):
|
102 |
pred,idx,probs = learn.predict(issue)
|
103 |
return pred
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
104 |
'''
|
105 |
https://www.gradio.app/docs/interface
|
106 |
'''
|
@@ -213,6 +220,27 @@ With no need for jargon, SSDS delivers tangible value to our fintech operations.
|
|
213 |
tuning the distance for use case
|
214 |
""")
|
215 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
216 |
with gr.Tab("Fine Tune LLM"):
|
217 |
in_like = gr.Textbox(placeholder="having credit card problem" , label="Issue",
|
218 |
info="issue you want to explore about")
|
|
|
101 |
def like(issue):
|
102 |
pred,idx,probs = learn.predict(issue)
|
103 |
return pred
|
104 |
+
|
105 |
+
'''
|
106 |
+
EXPLAINABLE AI
|
107 |
+
'''
|
108 |
+
import shap
|
109 |
+
from xgb import X_test
|
110 |
+
|
111 |
'''
|
112 |
https://www.gradio.app/docs/interface
|
113 |
'''
|
|
|
220 |
tuning the distance for use case
|
221 |
""")
|
222 |
|
223 |
+
with gr.Tab("Explainable AI"):
|
224 |
+
|
225 |
+
|
226 |
+
file_name = 'xgb/xgb.model'
|
227 |
+
bst = pickle.load(open(file_name, "rb"))
|
228 |
+
explainer_xgb = shap.Explainer(bst) # , X100)
|
229 |
+
shap_values_xgb = explainer_xgb(X_test)
|
230 |
+
|
231 |
+
sample_ind = 20
|
232 |
+
shap.partial_dependence_plot(
|
233 |
+
"dist_subway",
|
234 |
+
bst.predict,
|
235 |
+
X_test,
|
236 |
+
model_expected_value=True,
|
237 |
+
feature_expected_value=True,
|
238 |
+
ice=False,
|
239 |
+
shap_values=shap_values_xgb[sample_ind: sample_ind + 1, :],
|
240 |
+
)
|
241 |
+
shap.force_plot(explainer_xgb.expected_value, shap_values_xgb[0].values, X_test.iloc[0], matplotlib=True)
|
242 |
+
shap.plots.beeswarm(shap_values_xgb)
|
243 |
+
|
244 |
with gr.Tab("Fine Tune LLM"):
|
245 |
in_like = gr.Textbox(placeholder="having credit card problem" , label="Issue",
|
246 |
info="issue you want to explore about")
|
requirements.txt
CHANGED
@@ -5,3 +5,5 @@ pandas==2.1.3
|
|
5 |
#yfinance==0.2.31
|
6 |
#scikit-learn
|
7 |
plotly
|
|
|
|
|
|
5 |
#yfinance==0.2.31
|
6 |
#scikit-learn
|
7 |
plotly
|
8 |
+
shap
|
9 |
+
xgboost
|