@@ -30,13 +30,13 @@ def plot_group_kfold():
30
30
31
31
boxes = axes .barh (bottom = range (n_iter ), width = [1 - 0.1 ] * n_iter ,
32
32
left = i * n_samples_per_fold , height = .6 , color = colors ,
33
- hatch = "//" , edgecolor = "k" )
33
+ hatch = "//" , edgecolor = "k" , align = 'edge' )
34
34
for j in np .where (mask [:, i ] == 0 )[0 ]:
35
35
boxes [j ].set_hatch ("" )
36
36
37
37
axes .barh (bottom = [n_iter ] * n_folds , width = [1 - 0.1 ] * n_folds ,
38
38
left = np .arange (n_folds ) * n_samples_per_fold , height = .6 ,
39
- color = "w" , edgecolor = 'k' )
39
+ color = "w" , edgecolor = 'k' , align = "edge" )
40
40
41
41
for i in range (12 ):
42
42
axes .text ((i + .5 ) * n_samples_per_fold , 3.5 , "%d" %
@@ -82,7 +82,7 @@ def plot_shuffle_split():
82
82
83
83
boxes = axes .barh (bottom = range (n_iter ), width = [1 - 0.1 ] * n_iter ,
84
84
left = i * n_samples_per_fold , height = .6 , color = colors ,
85
- hatch = "//" , edgecolor = 'k' )
85
+ hatch = "//" , edgecolor = 'k' , align = 'edge' )
86
86
for j in np .where (mask [:, i ] == 0 )[0 ]:
87
87
boxes [j ].set_hatch ("" )
88
88
@@ -118,11 +118,11 @@ def plot_stratified_cross_validation():
118
118
colors [i ] = "grey"
119
119
axes .barh (bottom = range (n_folds ), width = [n_samples_per_fold - 1 ] *
120
120
n_folds , left = i * n_samples_per_fold , height = .6 ,
121
- color = colors , hatch = "//" , edgecolor = 'k' )
121
+ color = colors , hatch = "//" , edgecolor = 'k' , align = 'edge' )
122
122
123
123
axes .barh (bottom = [n_folds ] * n_folds , width = [n_samples_per_fold - 1 ] *
124
124
n_folds , left = np .arange (3 ) * n_samples_per_fold , height = .6 ,
125
- color = "w" , edgecolor = 'k' )
125
+ color = "w" , edgecolor = 'k' , align = 'edge' )
126
126
127
127
axes .invert_yaxis ()
128
128
axes .set_xlim (0 , n_samples + 1 )
@@ -155,23 +155,24 @@ def plot_stratified_cross_validation():
155
155
test_bars = ax .barh (
156
156
bottom = [i ] * n_folds , width = [n_subsplit - 1 ] * n_folds ,
157
157
left = np .arange (n_folds ) * n_samples_per_fold + i * n_subsplit ,
158
- height = .6 , color = "grey" , hatch = "//" , edgecolor = 'k' )
158
+ height = .6 , color = "grey" , hatch = "//" , edgecolor = 'k' , align = 'edge' )
159
159
160
160
w = 2 * n_subsplit - 1
161
161
ax .barh (bottom = [0 ] * n_folds , width = [w ] * n_folds , left = np .arange (n_folds )
162
162
* n_samples_per_fold + (0 + 1 ) * n_subsplit , height = .6 , color = "w" ,
163
- hatch = "//" , edgecolor = 'k' )
163
+ hatch = "//" , edgecolor = 'k' , align = 'edge' )
164
164
ax .barh (bottom = [1 ] * (n_folds + 1 ), width = [w / 2. , w , w , w / 2. ],
165
165
left = np .maximum (0 , np .arange (n_folds + 1 ) * n_samples_per_fold -
166
166
n_subsplit ), height = .6 , color = "w" , hatch = "//" ,
167
- edgecolor = 'k' )
167
+ edgecolor = 'k' , align = 'edge' )
168
168
training_bars = ax .barh (bottom = [2 ] * n_folds , width = [w ] * n_folds ,
169
169
left = np .arange (n_folds ) * n_samples_per_fold ,
170
- height = .6 , color = "w" , hatch = "//" , edgecolor = 'k' )
170
+ height = .6 , color = "w" , hatch = "//" , edgecolor = 'k' ,
171
+ align = 'edge' )
171
172
172
173
ax .barh (bottom = [n_folds ] * n_folds , width = [n_samples_per_fold - 1 ] *
173
174
n_folds , left = np .arange (n_folds ) * n_samples_per_fold , height = .6 ,
174
- color = "w" , edgecolor = 'k' )
175
+ color = "w" , edgecolor = 'k' , align = 'edge' )
175
176
176
177
for i in range (3 ):
177
178
ax .text ((i + .5 ) * n_samples_per_fold , 3.5 , "Class %d" %
@@ -200,7 +201,7 @@ def plot_cross_validation():
200
201
bars = plt .barh (
201
202
bottom = range (n_folds ), width = [n_samples_per_fold - 0.1 ] * n_folds ,
202
203
left = i * n_samples_per_fold , height = .6 , color = colors , hatch = "//" ,
203
- edgecolor = 'k' )
204
+ edgecolor = 'k' , align = 'edge' )
204
205
axes .invert_yaxis ()
205
206
axes .set_xlim (0 , n_samples + 1 )
206
207
plt .ylabel ("CV iterations" )
@@ -218,7 +219,8 @@ def plot_threefold_split():
218
219
plt .figure (figsize = (15 , 1 ))
219
220
axis = plt .gca ()
220
221
bars = axis .barh ([0 , 0 , 0 ], [11.9 , 2.9 , 4.9 ], left = [0 , 12 , 15 ], color = [
221
- 'white' , 'grey' , 'grey' ], hatch = "//" , edgecolor = 'k' )
222
+ 'white' , 'grey' , 'grey' ], hatch = "//" , edgecolor = 'k' ,
223
+ align = 'edge' )
222
224
bars [2 ].set_hatch (r"" )
223
225
axis .set_yticks (())
224
226
axis .set_frame_on (False )
0 commit comments