Spaces:
Sleeping
Sleeping
updated total attempts/ task attempted ratio
Browse files
app.py
CHANGED
|
@@ -208,8 +208,8 @@ def process_file(model_name,inc_slider,progress=Progress(track_tqdm=True)):
|
|
| 208 |
opt1_successful_first_attempts, opt2_successful_first_attempts
|
| 209 |
) = analyze_row(row)
|
| 210 |
|
| 211 |
-
opt1_ratios.append(
|
| 212 |
-
opt2_ratios.append(
|
| 213 |
# create a summey for task:attempted, total attempts and succesful attempts for each row
|
| 214 |
# row_summary.append({
|
| 215 |
# "row_index": i + 1,
|
|
@@ -274,9 +274,9 @@ def process_file(model_name,inc_slider,progress=Progress(track_tqdm=True)):
|
|
| 274 |
marker=dict(color='blue'),
|
| 275 |
opacity=1,
|
| 276 |
xbins=dict(
|
| 277 |
-
start=
|
| 278 |
-
end=
|
| 279 |
-
size=
|
| 280 |
)
|
| 281 |
))
|
| 282 |
fig_hist2=go.Figure()
|
|
@@ -287,20 +287,21 @@ def process_file(model_name,inc_slider,progress=Progress(track_tqdm=True)):
|
|
| 287 |
marker=dict(color='red'),
|
| 288 |
opacity=1,
|
| 289 |
xbins=dict(
|
| 290 |
-
start=
|
| 291 |
-
end=
|
| 292 |
-
size=
|
| 293 |
)
|
| 294 |
))
|
| 295 |
|
| 296 |
# Update layout
|
| 297 |
fig_hist1.update_layout(
|
| 298 |
-
title="ER: Histogram of
|
| 299 |
title_x=0.5,
|
| 300 |
xaxis=dict(
|
| 301 |
-
title="Success Ratio (
|
| 302 |
tickmode="array",
|
| 303 |
-
tickvals=
|
|
|
|
| 304 |
),
|
| 305 |
yaxis=dict(
|
| 306 |
title="Number of Instances"
|
|
@@ -320,12 +321,13 @@ def process_file(model_name,inc_slider,progress=Progress(track_tqdm=True)):
|
|
| 320 |
barmode='overlay' # Overlapping bars
|
| 321 |
)
|
| 322 |
fig_hist2.update_layout(
|
| 323 |
-
title="ME: Histogram of
|
| 324 |
title_x=0.5,
|
| 325 |
xaxis=dict(
|
| 326 |
-
title="Success Ratio (
|
| 327 |
tickmode="array",
|
| 328 |
-
tickvals=
|
|
|
|
| 329 |
),
|
| 330 |
yaxis=dict(
|
| 331 |
title="Number of Instances"
|
|
@@ -435,17 +437,17 @@ def process_file(model_name,inc_slider,progress=Progress(track_tqdm=True)):
|
|
| 435 |
|
| 436 |
progress(0.2, desc="analysis done!! Executing models")
|
| 437 |
print("finetuned task: ",finetune_task)
|
| 438 |
-
subprocess.run([
|
| 439 |
-
|
| 440 |
-
|
| 441 |
-
|
| 442 |
-
|
| 443 |
-
|
| 444 |
-
|
| 445 |
-
|
| 446 |
-
|
| 447 |
-
|
| 448 |
-
])
|
| 449 |
progress(0.6,desc="Model execution completed")
|
| 450 |
result = {}
|
| 451 |
with open("result.txt", 'r') as file:
|
|
|
|
| 208 |
opt1_successful_first_attempts, opt2_successful_first_attempts
|
| 209 |
) = analyze_row(row)
|
| 210 |
|
| 211 |
+
opt1_ratios.append( opt1_total_attempts / opt1_attempted if opt1_total_attempts > 0 else 0)
|
| 212 |
+
opt2_ratios.append( opt2_total_attempts / opt2_attempted if opt2_total_attempts > 0 else 0)
|
| 213 |
# create a summey for task:attempted, total attempts and succesful attempts for each row
|
| 214 |
# row_summary.append({
|
| 215 |
# "row_index": i + 1,
|
|
|
|
| 274 |
marker=dict(color='blue'),
|
| 275 |
opacity=1,
|
| 276 |
xbins=dict(
|
| 277 |
+
start=1.0,
|
| 278 |
+
end=max(opt1_ratios) if max(opt1_ratios) < 15 else 15,
|
| 279 |
+
size=1 # Bin width set to 0.1 for 10 bins
|
| 280 |
)
|
| 281 |
))
|
| 282 |
fig_hist2=go.Figure()
|
|
|
|
| 287 |
marker=dict(color='red'),
|
| 288 |
opacity=1,
|
| 289 |
xbins=dict(
|
| 290 |
+
start=1.0,
|
| 291 |
+
end=max(opt1_ratios) if max(opt1_ratios) < 15 else 15,
|
| 292 |
+
size=1 # Bin width set to 0.1 for 10 bins
|
| 293 |
)
|
| 294 |
))
|
| 295 |
|
| 296 |
# Update layout
|
| 297 |
fig_hist1.update_layout(
|
| 298 |
+
title="ER: Histogram of Attempts required per task",
|
| 299 |
title_x=0.5,
|
| 300 |
xaxis=dict(
|
| 301 |
+
title="Success Ratio ( Total Attempts / Tasks Attempted )",
|
| 302 |
tickmode="array",
|
| 303 |
+
tickvals=list(range(1, 11)) + [15], # 1,2,3,...10, 15+
|
| 304 |
+
ticktext=[str(i) for i in range(1, 11)] + ["10+"],
|
| 305 |
),
|
| 306 |
yaxis=dict(
|
| 307 |
title="Number of Instances"
|
|
|
|
| 321 |
barmode='overlay' # Overlapping bars
|
| 322 |
)
|
| 323 |
fig_hist2.update_layout(
|
| 324 |
+
title="ME: Histogram of Attempts required per task",
|
| 325 |
title_x=0.5,
|
| 326 |
xaxis=dict(
|
| 327 |
+
title="Success Ratio (Total Attempts / Tasks Attempted)",
|
| 328 |
tickmode="array",
|
| 329 |
+
tickvals=list(range(1, 11)) + [15], # 1,2,3,...10, 15+
|
| 330 |
+
ticktext=[str(i) for i in range(1, 11)] + ["10+"],
|
| 331 |
),
|
| 332 |
yaxis=dict(
|
| 333 |
title="Number of Instances"
|
|
|
|
| 437 |
|
| 438 |
progress(0.2, desc="analysis done!! Executing models")
|
| 439 |
print("finetuned task: ",finetune_task)
|
| 440 |
+
# subprocess.run([
|
| 441 |
+
# "python", "new_test_saved_finetuned_model.py",
|
| 442 |
+
# "-workspace_name", "ratio_proportion_change3_2223/sch_largest_100-coded",
|
| 443 |
+
# "-finetune_task", finetune_task,
|
| 444 |
+
# "-test_dataset_path","../../../../selected_rows.txt",
|
| 445 |
+
# # "-test_label_path","../../../../train_label.txt",
|
| 446 |
+
# "-finetuned_bert_classifier_checkpoint",
|
| 447 |
+
# "ratio_proportion_change3_2223/sch_largest_100-coded/output/highGRschool10/bert_fine_tuned.model.ep42",
|
| 448 |
+
# "-e",str(1),
|
| 449 |
+
# "-b",str(1000)
|
| 450 |
+
# ])
|
| 451 |
progress(0.6,desc="Model execution completed")
|
| 452 |
result = {}
|
| 453 |
with open("result.txt", 'r') as file:
|