Commit
•
cfc3dfa
1
Parent(s):
650b1b4
Update app.py
Browse files
app.py
CHANGED
@@ -90,36 +90,33 @@ def get_model_infomation():
|
|
90 |
|
91 |
return model_info, feature_impact
|
92 |
|
93 |
-
def get_featuredrift():
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
# drift_df.loc[(drift_df['drift_score']>drift_threshold)&(drift_df['feature_impact']>impact_threshold), 'alert'] = '重要性の高く、大きなドリフト'
|
119 |
-
# drift_df.loc[(drift_df['drift_score']>drift_threshold)&(drift_df['feature_impact']<=impact_threshold), 'alert'] = '重要性低いが、大きなドリフト'
|
120 |
-
# drift_df.loc[(drift_df['drift_score']<=drift_threshold), 'alert'] = '正常'
|
121 |
|
122 |
-
|
123 |
|
124 |
with gr.Blocks() as electoric_ploting:
|
125 |
gr.Markdown(
|
@@ -203,45 +200,45 @@ with gr.Blocks() as electoric_ploting:
|
|
203 |
y_lim=[0, 1.2],
|
204 |
width=400,
|
205 |
height=300)
|
206 |
-
with gr.Tab("データドリフト情報"):
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
|
246 |
retrain_btn.click(retrain, inputs=None, outputs = [output_model_type, output_acc, output_plot])
|
247 |
|
|
|
90 |
|
91 |
return model_info, feature_impact
|
92 |
|
93 |
+
# def get_featuredrift():
|
94 |
+
# deployment = dr.Deployment.get(deployment_id='640d791796a6a52d92c368a0')
|
95 |
+
# target_drift = dr.models.TargetDrift.get(deployment.id)
|
96 |
+
# feature_drift_list = dr.models.FeatureDrift.list(deployment.id)
|
97 |
+
# drift_df = pd.DataFrame(
|
98 |
+
# {
|
99 |
+
# 'feature_name':[target_drift.target_name],
|
100 |
+
# 'drift_score':[target_drift.drift_score],
|
101 |
+
# 'feature_impact':[1]
|
102 |
+
# }
|
103 |
+
# )
|
104 |
+
# drift_df = pd.concat([
|
105 |
+
# drift_df,
|
106 |
+
# pd.DataFrame(
|
107 |
+
# [[
|
108 |
+
# feature_drift.name,
|
109 |
+
# feature_drift.drift_score,
|
110 |
+
# feature_drift.feature_impact
|
111 |
+
# ] for feature_drift in feature_drift_list
|
112 |
+
# ],
|
113 |
+
# columns=[ 'feature_name', 'drift_score', 'feature_impact']
|
114 |
+
# )
|
115 |
+
# ])
|
116 |
+
# start_point = (target_drift.period['start']+relativedelta(hours=9)).strftime("%Y / %m / %d %H:%M:%S")
|
117 |
+
# end_point = (target_drift.period['end']+relativedelta(hours=9)).strftime("%Y / %m / %d %H:%M:%S")
|
|
|
|
|
|
|
118 |
|
119 |
+
# return drift_df, start_point, end_point
|
120 |
|
121 |
with gr.Blocks() as electoric_ploting:
|
122 |
gr.Markdown(
|
|
|
200 |
y_lim=[0, 1.2],
|
201 |
width=400,
|
202 |
height=300)
|
203 |
+
# with gr.Tab("データドリフト情報"):
|
204 |
+
# result = get_featuredrift()
|
205 |
+
# with gr.Row():
|
206 |
+
# gr.Markdown(
|
207 |
+
# """
|
208 |
+
# こちらの図はデータドリフトと特徴量の有用性を表した図になっています。
|
209 |
+
# 味方は以下の通り
|
210 |
+
# * ドリフトスコア:予測データに含まれるデータが、どれぐらい過去のデータに比べてずれが発生しているかを表しており、上に行けば行くほどズレが大きい
|
211 |
+
# * 特徴量の有用性:ターゲットの有用性を1とした時に、どれぐらいそれぞれの特徴量の有用性が高いかを表したもので、右に行くほど有用性が高い
|
212 |
+
# """
|
213 |
+
# )
|
214 |
+
# with gr.Row():
|
215 |
+
# drift_df = result[0]
|
216 |
+
# start_point = result[1]
|
217 |
+
# end_point = result[2]
|
218 |
+
# gr.Textbox(f"{start_point}〜{end_point}",label=f'データドリフト確認期間')
|
219 |
+
# with gr.Row():
|
220 |
+
# if len(drift_df["drift_score"].unique())!=1:
|
221 |
+
# gr.ScatterPlot(
|
222 |
+
# drift_df,
|
223 |
+
# x="feature_impact",
|
224 |
+
# y="drift_score",
|
225 |
+
# title="データドリフトとデータの有用性",
|
226 |
+
# color_legend_title="Species",
|
227 |
+
# x_title="特徴量の有用性",
|
228 |
+
# y_title="ドリフトスコア",
|
229 |
+
# x_lim = [-0.1, drift_df["feature_impact"].max()*1.4],
|
230 |
+
# y_lim = [-0.1, drift_df["drift_score"].max()*1.4],
|
231 |
+
# tooltip=["feature_name", "feature_impact", "drift_score"],
|
232 |
+
# caption="",
|
233 |
+
# height=500,
|
234 |
+
# width=500
|
235 |
+
# )
|
236 |
+
# else:
|
237 |
+
# gr.Markdown(
|
238 |
+
# """
|
239 |
+
# モデルの入れ替え後に予測が実行されていないためdriftは表示できません。
|
240 |
+
# """
|
241 |
+
# )
|
242 |
|
243 |
retrain_btn.click(retrain, inputs=None, outputs = [output_model_type, output_acc, output_plot])
|
244 |
|