@@ -143,7 +143,8 @@ def create_html_plot(dataset, link_flows, hour_count, title, output_html_path="s
143
143
u , v = dataset .target_graph .edge_index [0 ][i ].item (), dataset .target_graph .edge_index [1 ][i ].item ()
144
144
145
145
if i in sensor_idxs :
146
- edge_attrs = {"Absolute Difference" : [], "Predicted Flow" : [], "Target Flow" : []}
146
+ edge_attrs = {"Link id" :[], "Absolute Difference" : [], "Predicted Flow" : [], "Target Flow" : []}
147
+ link_id = dataset .edge_mapping .inv [i ]
147
148
148
149
for hour_idx in range (hour_count ):
149
150
if isinstance (link_flows , torch .Tensor ):
@@ -159,6 +160,7 @@ def create_html_plot(dataset, link_flows, hour_count, title, output_html_path="s
159
160
160
161
abs_diff = abs (target_flow - pred_flow )
161
162
163
+ edge_attrs ["Link id" ].append (link_id )
162
164
edge_attrs ["Absolute Difference" ].append (abs_diff )
163
165
edge_attrs ["Predicted Flow" ].append (pred_flow )
164
166
edge_attrs ["Target Flow" ].append (target_flow )
@@ -178,7 +180,7 @@ def create_html_plot(dataset, link_flows, hour_count, title, output_html_path="s
178
180
# Build plot data
179
181
sensor_edges = []
180
182
normal_edges = []
181
- weight_all_hours , pred_all_hours , target_all_hours = [], [], []
183
+ weight_all_hours , pred_all_hours , target_all_hours , link_id_all_hours = [], [], [], []
182
184
183
185
for (u , v , data ) in tqdm (G_sensor .edges (data = True ), desc = "Processing Sensor Edges" ):
184
186
if "Absolute Difference" in data :
@@ -201,16 +203,19 @@ def create_html_plot(dataset, link_flows, hour_count, title, output_html_path="s
201
203
weight_all_hours .append (data ["Absolute Difference" ])
202
204
pred_all_hours .append (data ["Predicted Flow" ])
203
205
target_all_hours .append (data ["Target Flow" ])
206
+ link_id_all_hours .append (data ["Link id" ])
204
207
205
208
sensors_edge_source = ColumnDataSource (data = dict (
206
209
x0 = s_x0s , y0 = s_y0s , x1 = s_x1s , y1 = s_y1s ,
207
210
mid_x = mid_x , mid_y = mid_y ,
208
211
weight = [w [0 ] for w in weight_all_hours ],
209
212
predicted = [p [0 ] for p in pred_all_hours ],
210
213
target = [t [0 ] for t in target_all_hours ],
214
+ link_id = [l [0 ] for l in link_id_all_hours ],
211
215
weight_all_hours = weight_all_hours ,
212
216
predicted_all_hours = pred_all_hours ,
213
217
target_all_hours = target_all_hours ,
218
+ link_id_all_hours = link_id_all_hours ,
214
219
))
215
220
216
221
# Normal edges (black)
@@ -250,7 +255,7 @@ def create_html_plot(dataset, link_flows, hour_count, title, output_html_path="s
250
255
plot .scatter (node_x , node_y , size = .01 , color = "black" , alpha = 0.1 )
251
256
252
257
# Hover tool
253
- tooltips = [("Abs Diff" , "@weight" ), ("Predicted" , "@predicted" ), ("Target" , "@target" )]
258
+ tooltips = [("Link ID" , "@link_id" ),( " Abs Diff" , "@weight" ), ("Predicted" , "@predicted" ), ("Target" , "@target" )]
254
259
hover = HoverTool (tooltips = tooltips )
255
260
plot .add_tools (hover )
256
261
@@ -297,6 +302,7 @@ def create_html_plot(dataset, link_flows, hour_count, title, output_html_path="s
297
302
const weights_all = source.data['weight_all_hours'];
298
303
const preds_all = source.data['predicted_all_hours'];
299
304
const targets_all = source.data['target_all_hours'];
305
+ const link_ids_all = source.data['link_id_all_hours'];
300
306
301
307
const weights = [];
302
308
for (let i = 0; i < mids_x.length; i++) {
@@ -306,6 +312,7 @@ def create_html_plot(dataset, link_flows, hour_count, title, output_html_path="s
306
312
source.data['weight'][i] = weights_all[i][hour];
307
313
source.data['predicted'][i] = preds_all[i][hour];
308
314
source.data['target'][i] = targets_all[i][hour];
315
+ source.data['link_id'][i] = link_ids_all[i][hour];
309
316
}
310
317
311
318
const bin_count = 20;
0 commit comments