@@ -127,16 +127,7 @@ class _RobustWeightedEstimator(BaseEstimator):
127
127
128
128
max_iter : int, default=100
129
129
Maximum number of iterations.
130
- For more information, see the optimization scheme of base_estimator
131
- and the eta0 and burn_in parameter.
132
-
133
- burn_in : int, default=10
134
- Number of steps used without changing the learning rate.
135
- Can be useful to make the weight estimation better at the beginning.
136
-
137
- eta0 : float, default=0.01
138
- Constant step-size used during the burn_in period. Used only if
139
- burn_in>0. Can have a big effect on efficiency.
130
+ For more information, see the optimization scheme of base_estimator.
140
131
141
132
c : float>0 or None, default=None
142
133
Parameter used for Huber weighting procedure, used only if weightings
@@ -189,8 +180,7 @@ class _RobustWeightedEstimator(BaseEstimator):
189
180
For now only scikit-learn SGDRegressor and SGDClassifier are officially
190
181
supported but one can use any estimator compatible with scikit-learn,
191
182
as long as this estimator support partial_fit, warm_start and sample_weight
192
- . It must have the parameters max_iter and support "constant" learning rate
193
- with learning rate called "eta0".
183
+ . It must have the parameters max_iter.
194
184
195
185
For now, only binary classification is implemented. See sklearn.multiclass
196
186
if you want to use this algorithm in multiclass classification.
@@ -221,8 +211,6 @@ def __init__(
221
211
loss ,
222
212
weighting = "huber" ,
223
213
max_iter = 100 ,
224
- burn_in = 10 ,
225
- eta0 = 0.1 ,
226
214
c = None ,
227
215
k = 0 ,
228
216
tol = 1e-5 ,
@@ -232,8 +220,6 @@ def __init__(
232
220
):
233
221
self .base_estimator = base_estimator
234
222
self .weighting = weighting
235
- self .eta0 = eta0
236
- self .burn_in = burn_in
237
223
self .c = c
238
224
self .k = k
239
225
self .loss = loss
@@ -282,16 +268,10 @@ def fit(self, X, y=None):
282
268
if ("loss" in parameters ) and (loss_param != "squared_error" ):
283
269
base_estimator .set_params (loss = loss_param )
284
270
285
- if "eta0" in parameters :
286
- base_estimator .set_params (eta0 = self .eta0 )
287
-
288
271
if "n_iter_no_change" in parameters :
289
272
base_estimator .set_params (n_iter_no_change = self .n_iter_no_change )
290
273
291
274
base_estimator .set_params (random_state = random_state )
292
- if self .burn_in > 0 :
293
- learning_rate = base_estimator .learning_rate
294
- base_estimator .set_params (learning_rate = "constant" , eta0 = self .eta0 )
295
275
296
276
# Initialization
297
277
if self ._estimator_type == "classifier" :
@@ -329,11 +309,6 @@ def fit(self, X, y=None):
329
309
# Optimization algorithm
330
310
for epoch in range (self .max_iter ):
331
311
332
- if epoch > self .burn_in and self .burn_in > 0 :
333
- # If not in the burn_in phase anymore, change the learning_rate
334
- # calibration to the one edicted by self.base_estimator.
335
- base_estimator .set_params (learning_rate = learning_rate )
336
-
337
312
if self ._estimator_type == "classifier" :
338
313
# If in classification, use decision_function
339
314
pred = base_estimator .decision_function (X )
@@ -448,12 +423,6 @@ def _validate_hyperparameters(self, n):
448
423
if not (self .c is None ) and (self .c <= 0 ):
449
424
raise ValueError ("c must be > 0, got %s." % self .c )
450
425
451
- if self .burn_in < 0 :
452
- raise ValueError ("burn_in must be >= 0, got %s." % self .burn_in )
453
-
454
- if (self .burn_in > 0 ) and (self .eta0 <= 0 ):
455
- raise ValueError ("eta0 must be > 0, got %s." % self .eta0 )
456
-
457
426
if not (self .k is None ) and (
458
427
not isinstance (self .k , int )
459
428
or self .k < 0
@@ -619,16 +588,7 @@ class RobustWeightedClassifier(BaseEstimator, ClassifierMixin):
619
588
620
589
max_iter : int, default=100
621
590
Maximum number of iterations.
622
- For more information, see the optimization scheme of base_estimator
623
- and the eta0 and burn_in parameter.
624
-
625
- burn_in : int, default=10
626
- Number of steps used without changing the learning rate.
627
- Can be useful to make the weight estimation better at the beginning.
628
-
629
- eta0 : float, default=0.01
630
- Constant step-size used during the burn_in period. Used only if
631
- burn_in>0. Can have a big effect on efficiency.
591
+ For more information, see the optimization scheme of base_estimator.
632
592
633
593
c : float>0 or None, default=None
634
594
Parameter used for Huber weighting procedure, used only if weightings
@@ -748,8 +708,6 @@ def __init__(
748
708
self ,
749
709
weighting = "huber" ,
750
710
max_iter = 100 ,
751
- burn_in = 10 ,
752
- eta0 = 0.01 ,
753
711
c = None ,
754
712
k = 0 ,
755
713
loss = "log" ,
@@ -763,8 +721,6 @@ def __init__(
763
721
):
764
722
self .weighting = weighting
765
723
self .max_iter = max_iter
766
- self .burn_in = burn_in
767
- self .eta0 = eta0
768
724
self .c = c
769
725
self .k = k
770
726
self .loss = loss
@@ -802,13 +758,11 @@ def fit(self, X, y):
802
758
X , y = self ._validate_data (X , y , y_numeric = False )
803
759
804
760
base_robust_estimator_ = _RobustWeightedEstimator (
805
- SGDClassifier (** sgd_args , eta0 = self . eta0 ),
761
+ SGDClassifier (** sgd_args ),
806
762
weighting = self .weighting ,
807
763
loss = self .loss ,
808
- burn_in = self .burn_in ,
809
764
c = self .c ,
810
765
k = self .k ,
811
- eta0 = self .eta0 ,
812
766
max_iter = self .max_iter ,
813
767
tol = self .tol ,
814
768
n_iter_no_change = self .n_iter_no_change ,
@@ -951,16 +905,7 @@ class RobustWeightedRegressor(BaseEstimator, RegressorMixin):
951
905
952
906
max_iter : int, default=100
953
907
Maximum number of iterations.
954
- For more information, see the optimization scheme of base_estimator
955
- and the eta0 and burn_in parameter.
956
-
957
- burn_in : int, default=10
958
- Number of steps used without changing the learning rate.
959
- Can be useful to make the weight estimation better at the beginning.
960
-
961
- eta0 : float, default=0.01
962
- Constant step-size used during the burn_in period. Used only if
963
- burn_in>0. Can have a big effect on efficiency.
908
+ For more information, see the optimization scheme of base_estimator.
964
909
965
910
c : float>0 or None, default=None
966
911
Parameter used for Huber weighting procedure, used only if weightings
@@ -1062,8 +1007,6 @@ def __init__(
1062
1007
self ,
1063
1008
weighting = "huber" ,
1064
1009
max_iter = 100 ,
1065
- burn_in = 10 ,
1066
- eta0 = 0.01 ,
1067
1010
c = None ,
1068
1011
k = 0 ,
1069
1012
loss = SQ_LOSS ,
@@ -1076,8 +1019,6 @@ def __init__(
1076
1019
1077
1020
self .weighting = weighting
1078
1021
self .max_iter = max_iter
1079
- self .burn_in = burn_in
1080
- self .eta0 = eta0
1081
1022
self .c = c
1082
1023
self .k = k
1083
1024
self .loss = loss
@@ -1113,13 +1054,11 @@ def fit(self, X, y):
1113
1054
X , y = self ._validate_data (X , y , y_numeric = True )
1114
1055
1115
1056
self .base_estimator_ = _RobustWeightedEstimator (
1116
- SGDRegressor (** sgd_args , eta0 = self . eta0 ),
1057
+ SGDRegressor (** sgd_args ),
1117
1058
weighting = self .weighting ,
1118
1059
loss = self .loss ,
1119
- burn_in = self .burn_in ,
1120
1060
c = self .c ,
1121
1061
k = self .k ,
1122
- eta0 = self .eta0 ,
1123
1062
max_iter = self .max_iter ,
1124
1063
tol = self .tol ,
1125
1064
n_iter_no_change = self .n_iter_no_change ,
@@ -1202,12 +1141,7 @@ class RobustWeightedKMeans(BaseEstimator, ClusterMixin):
1202
1141
1203
1142
max_iter : int, default=100
1204
1143
Maximum number of iterations.
1205
- For more information, see the optimization scheme of base_estimator
1206
- and the eta0 and burn_in parameter.
1207
-
1208
- eta0 : float, default=0.01
1209
- Constant step-size used during the burn_in period. Used only if
1210
- burn_in>0. Can have a big effect on efficiency.
1144
+ For more information, see the optimization scheme of base_estimator.
1211
1145
1212
1146
c : float>0 or None, default=None
1213
1147
Parameter used for Huber weighting procedure, used only if weightings
@@ -1314,7 +1248,6 @@ def __init__(
1314
1248
n_clusters = 8 ,
1315
1249
weighting = "huber" ,
1316
1250
max_iter = 100 ,
1317
- eta0 = 0.01 ,
1318
1251
c = None ,
1319
1252
k = 0 ,
1320
1253
kmeans_args = None ,
@@ -1326,7 +1259,6 @@ def __init__(
1326
1259
self .n_clusters = n_clusters
1327
1260
self .weighting = weighting
1328
1261
self .max_iter = max_iter
1329
- self .eta0 = eta0
1330
1262
self .c = c
1331
1263
self .k = k
1332
1264
self .kmeans_args = kmeans_args
@@ -1369,13 +1301,9 @@ def fit(self, X, y=None):
1369
1301
random_state = self .random_state ,
1370
1302
** kmeans_args
1371
1303
),
1372
- burn_in = 0 , # Important because it does not mean anything to
1373
- # have burn-in
1374
- # steps for kmeans. It must be 0.
1375
1304
weighting = self .weighting ,
1376
1305
loss = _kmeans_loss ,
1377
1306
max_iter = self .max_iter ,
1378
- eta0 = self .eta0 ,
1379
1307
c = self .c ,
1380
1308
k = self .k ,
1381
1309
tol = self .tol ,
0 commit comments