@@ -72,20 +72,24 @@ def main(log_dir: Path, xlim: int = 15):
7272 streaks = win_streaks [model ]
7373 max_streaks .append (max (streaks ) if streaks else 0 )
7474
75- # Use xlim as the display maximum
76- display_columns = xlim
75+ # Use xlim as the display maximum, start from streak length 2
76+ display_columns = xlim - 1 # Exclude length 1, so columns represent 2 through xlim
7777 streak_matrix = np .zeros ((len (models ), display_columns ))
7878
7979 for i , model in enumerate (models ):
8080 streaks = win_streaks [model ]
8181 for streak_len in streaks :
82+ # Skip streaks of length 1
83+ if streak_len == 1 :
84+ continue
85+ # Map streak_len 2 to column 0, 3 to column 1, etc.
8286 if streak_len < xlim :
83- streak_matrix [i , streak_len - 1 ] += 1
87+ streak_matrix [i , streak_len - 2 ] += 1
8488 else :
8589 # Aggregate all streaks >= xlim into the last column
86- streak_matrix [i , xlim - 1 ] += 1
90+ streak_matrix [i , display_columns - 1 ] += 1
8791
88- # Normalize by total streaks for each model
92+ # Normalize by total streaks for each model (excluding length 1)
8993 for i in range (len (models )):
9094 total = np .sum (streak_matrix [i , :])
9195 if total > 0 :
@@ -100,11 +104,15 @@ def main(log_dir: Path, xlim: int = 15):
100104 for i , model in enumerate (models ):
101105 streaks = win_streaks [model ]
102106 for streak_len in streaks :
107+ # Skip streaks of length 1
108+ if streak_len == 1 :
109+ continue
110+ # Map streak_len 2 to column 0, 3 to column 1, etc.
103111 if streak_len < xlim :
104- absolute_counts [i , streak_len - 1 ] += 1
112+ absolute_counts [i , streak_len - 2 ] += 1
105113 else :
106114 # Aggregate all streaks >= xlim into the last column
107- absolute_counts [i , xlim - 1 ] += 1
115+ absolute_counts [i , display_columns - 1 ] += 1
108116
109117 # Add percentage and absolute count labels to ALL cells
110118 for i in range (len (models )):
@@ -124,12 +132,20 @@ def main(log_dir: Path, xlim: int = 15):
124132 fontproperties = FONT_BOLD ,
125133 )
126134
127- plt .xlabel ("Win Streak Length " , fontproperties = FONT_BOLD , fontsize = 18 )
135+ plt .xlabel ("Consecutive Rounds Won " , fontproperties = FONT_BOLD , fontsize = 18 )
128136
129- # Create x-axis labels with the last one as "xlim+"
130- x_labels = [str (i ) for i in range (1 , xlim )] + [f"{ xlim } +" ]
137+ # Create x-axis labels starting from 2, with the last one as "xlim+"
138+ x_labels = [str (i ) for i in range (2 , xlim )] + [f"{ xlim } +" ]
131139 plt .xticks (range (display_columns ), x_labels , fontproperties = FONT_BOLD , fontsize = 14 )
132- plt .yticks (range (len (models )), [MODEL_TO_DISPLAY_NAME [m ] for m in models ], fontproperties = FONT_BOLD , fontsize = 14 )
140+
141+ # Create y-axis labels with total streak counts (excluding length 1)
142+ y_labels = []
143+ for model in models :
144+ total_streaks = sum (1 for streak_len in win_streaks [model ] if streak_len >= 2 )
145+ display_name = MODEL_TO_DISPLAY_NAME [model ]
146+ y_labels .append (f"{ display_name } \n (n={ total_streaks } )" )
147+
148+ plt .yticks (range (len (models )), y_labels , fontproperties = FONT_BOLD , fontsize = 14 )
133149 # plt.colorbar(im, label="Percentage of Streaks")
134150 plt .tight_layout ()
135151 plt .savefig (OUTPUT_FILE , dpi = 300 , bbox_inches = "tight" )
0 commit comments