raminass commited on
Commit
95eb387
·
verified ·
1 Parent(s): 747849d

add prediction score to accuracy

Browse files
Files changed (1) hide show
  1. app.py +15 -0
app.py CHANGED
@@ -43,6 +43,16 @@ def update_year(year):
43
  label="Select Justices",
44
  )
45
 
 
 
 
 
 
 
 
 
 
 
46
 
47
  with gr.Blocks() as demo:
48
  with gr.Row():
@@ -77,6 +87,11 @@ with gr.Blocks() as demo:
77
  num_top_classes=9, label="Predicted author of opinion"
78
  )
79
  output_textbox = gr.Textbox(label="Output Text", show_copy_button=True)
 
 
 
 
 
80
 
81
  year.release(
82
  update_year,
 
43
  label="Select Justices",
44
  )
45
 
46
+ # Paragraph text
47
+ paragraph_text = (
48
+ "One can refine these observations based on the prediction scores obtained in each case. "
49
+ "As explained in the Methods, these scores do not correspond to probabilities but can be calibrated "
50
+ "based on the cross-validation results. In particular, when we trained the algorithm we noticed that if "
51
+ "the top prediction score is greater than 40% (50%, 60%), our accuracy in predicting the authoring justice "
52
+ "increases to 93% (95%, 96%, respectively). Similarly, the original accuracy further improves to 95% when "
53
+ "considering the top two predictions per opinion, rather than a single one. If the sum of the top two prediction "
54
+ "scores exceeds 50%, the accuracy increases to 98%."
55
+ )
56
 
57
  with gr.Blocks() as demo:
58
  with gr.Row():
 
87
  num_top_classes=9, label="Predicted author of opinion"
88
  )
89
  output_textbox = gr.Textbox(label="Output Text", show_copy_button=True)
90
+ info_textbox = gr.Textbox(
91
+ value=paragraph_text,
92
+ label="Additional Insights",
93
+ interactive=False, # Makes the textbox read-only
94
+ )
95
 
96
  year.release(
97
  update_year,