File tree Expand file tree Collapse file tree 1 file changed +5
-1
lines changed
Expand file tree Collapse file tree 1 file changed +5
-1
lines changed Original file line number Diff line number Diff line change @@ -305,14 +305,18 @@ def _predict_zero_one_propensity(learner, X):
305305
306306
307307def _get_bracket_guess (score , coef_start , coef_bounds ):
308+ # Ensure coef_start is a scalar (handles 1-element arrays from optimizers)
309+ if isinstance (coef_start , np .ndarray ):
310+ coef_start = coef_start .item ()
311+
308312 max_bracket_length = coef_bounds [1 ] - coef_bounds [0 ]
309313 b_guess = coef_bounds
310314 delta = 0.1
311315 s_different = False
312316 while (not s_different ) & (delta <= 1.0 ):
313317 a = np .maximum (coef_start - delta * max_bracket_length / 2 , coef_bounds [0 ])
314318 b = np .minimum (coef_start + delta * max_bracket_length / 2 , coef_bounds [1 ])
315- b_guess = (a , b )
319+ b_guess = (float ( a ), float ( b ) )
316320 f_a = score (b_guess [0 ])
317321 f_b = score (b_guess [1 ])
318322 s_different = np .sign (f_a ) != np .sign (f_b )
You can’t perform that action at this time.
0 commit comments