@@ -87,7 +87,7 @@ class BaseSGD(SparseCoefMixin, BaseEstimator, metaclass=ABCMeta):
87
87
"verbose" : ["verbose" ],
88
88
"random_state" : ["random_state" ],
89
89
"warm_start" : ["boolean" ],
90
- "average" : [Interval (Integral , 0 , None , closed = "left " ), "boolean" ],
90
+ "average" : [Interval (Integral , 0 , None , closed = "neither " ), "boolean" ],
91
91
}
92
92
93
93
def __init__ (
@@ -597,17 +597,6 @@ def _partial_fit(
597
597
reset = first_call ,
598
598
)
599
599
600
- if first_call :
601
- # TODO(1.7) remove 0 from average parameter constraint
602
- if not isinstance (self .average , (bool , np .bool_ )) and self .average == 0 :
603
- warnings .warn (
604
- (
605
- "Passing average=0 to disable averaging is deprecated and will"
606
- " be removed in 1.7. Please use average=False instead."
607
- ),
608
- FutureWarning ,
609
- )
610
-
611
600
n_samples , n_features = X .shape
612
601
613
602
_check_partial_fit_first_call (self , classes )
@@ -683,16 +672,6 @@ def _fit(
683
672
# delete the attribute otherwise _partial_fit thinks it's not the first call
684
673
delattr (self , "classes_" )
685
674
686
- # TODO(1.7) remove 0 from average parameter constraint
687
- if
10000
span> not isinstance (self .average , (bool , np .bool_ )) and self .average == 0 :
688
- warnings .warn (
689
- (
690
- "Passing average=0 to disable averaging is deprecated and will be "
691
- "removed in 1.7. Please use average=False instead."
692
- ),
693
- FutureWarning ,
694
- )
695
-
696
675
# labels can be encoded as float, int, or string literals
697
676
# np.unique sorts in asc order; largest class id is positive class
698
677
y = validate_data (self , y = y )
@@ -1477,17 +1456,6 @@ def _partial_fit(
1477
1456
)
1478
1457
y = y .astype (X .dtype , copy = False )
1479
1458
1480
- if first_call :
1481
- # TODO(1.7) remove 0 from average parameter constraint
1482
- if not isinstance (self .average , (bool , np .bool_ )) and self .average == 0 :
1483
- warnings .warn (
1484
- (
1485
- "Passing average=0 to disable averaging is deprecated and will"
1486
- " be removed in 1.7. Please use average=False instead."
1487
- ),
1488
- FutureWarning ,
1489
- )
1490
-
1491
1459
n_samples , n_features = X .shape
1492
1460
1493
1461
sample_weight = _check_sample_weight (sample_weight , X , dtype = X .dtype )
@@ -1565,16 +1533,6 @@ def _fit(
1565
1533
intercept_init = None ,
1566
1534
sample_weight = None ,
1567
1535
):
1568
- # TODO(1.7) remove 0 from average parameter constraint
1569
- if not isinstance (self .average , (bool , np .bool_ )) and self .average == 0 :
1570
- warnings .warn (
1571
- (
1572
- "Passing average=0 to disable averaging is deprecated and will be "
1573
- "removed in 1.7. Please use average=False instead."
1574
- ),
1575
- FutureWarning ,
1576
- )
1577
-
1578
1536
if self .warm_start and getattr (self , "coef_" , None ) is not None :
1579
1537
if coef_init is None :
1580
1538
coef_init = self .coef_
@@ -2387,17 +2345,6 @@ def _partial_fit(
2387
2345
reset = first_call ,
2388
2346
)
2389
2347
2390
- if first_call :
2391
- # TODO(1.7) remove 0 from average parameter constraint
2392
- if not isinstance (self .average , (bool , np .bool_ )) and self .average == 0 :
2393
- warnings .warn (
2394
- (
2395
- "Passing average=0 to disable averaging is deprecated and will"
2396
- " be removed in 1.7. Please use average=False instead."
2397
- ),
2398
- FutureWarning ,
2399
- )
2400
-
2401
2348
n_features = X .shape [1 ]
2402
2349
2403
2350
# Allocate datastructures from input arguments
@@ -2488,16 +2435,6 @@ def _fit(
2488
2435
offset_init = None ,
2489
2436
sample_weight = None ,
2490
2437
):
2491
- # TODO(1.7) remove 0 from average parameter constraint
2492
- if not isinstance (self .average , (bool , np .bool_ )) and self .average == 0 :
2493
- warnings .warn (
2494
- (
2495
- "Passing average=0 to disable averaging is deprecated and will be "
2496
- "removed in 1.7. Please use average=False instead."
2497
- ),
2498
- FutureWarning ,
2499
- )
2500
-
2501
2438
if self .warm_start and hasattr (self , "coef_" ):
2502
2439
if coef_init is None :
2503
2440
coef_init = self .coef_
0 commit comments