@@ -437,10 +437,10 @@ def __init__(
437
437
max_features = "sqrt" ,
438
438
max_leaf_nodes = None ,
439
439
min_impurity_decrease = 0.0 ,
440
- bootstrap = "warn" ,
440
+ bootstrap = False ,
441
441
oob_score = False ,
442
- sampling_strategy = "warn " ,
443
- replacement = "warn" ,
442
+ sampling_strategy = "all " ,
443
+ replacement = True ,
444
444
n_jobs = None ,
445
445
random_state = None ,
446
446
verbose = 0 ,
@@ -498,7 +498,7 @@ def _validate_estimator(self, default=DecisionTreeClassifier()):
498
498
499
499
self .base_sampler_ = RandomUnderSampler (
500
500
sampling_strategy = self ._sampling_strategy ,
501
- replacement = self ._replacement ,
501
+ replacement = self .replacement ,
502
502
)
503
503
504
504
def _make_sampler_estimator (self , random_state = None ):
@@ -544,49 +544,6 @@ def fit(self, X, y, sample_weight=None):
544
544
The fitted instance.
545
545
"""
546
546
self ._validate_params ()
547
- # TODO: remove in 0.13
548
- if self .sampling_strategy == "warn" :
549
- warn (
550
- (
551
- "The default of `sampling_strategy` will change from `'auto'` to"
552
- " `'all'` in version 0.13. This change will follow the"
553
- " implementation proposed in the original paper. Set to `'all'` to"
554
- " silence this warning and adopt the future behaviour."
555
- ),
556
- FutureWarning ,
557
- )
558
- self ._sampling_strategy = "auto"
559
- else :
560
- self ._sampling_strategy = self .sampling_strategy
561
-
562
- if self .replacement == "warn" :
563
- warn (
564
- (
565
- "The default of `replacement` will change from `False` to `True` in"
566
- " version 0.13. This change will follow the implementation proposed"
567
- " in the original paper. Set to `True` to silence this warning and"
568
- " adopt the future behaviour."
569
- ),
570
- FutureWarning ,
571
- )
572
- self ._replacement = False
573
- else :
574
- self ._replacement = self .replacement
575
-
576
- if self .bootstrap == "warn" :
577
- warn (
578
- (
579
- "The default of `bootstrap` will change from `True` to `False` in"
580
- " version 0.13. This change will follow the implementation proposed"
581
- " in the original paper. Set to `False` to silence this warning and"
582
- " adopt the future behaviour."
583
- ),
584
- FutureWarning ,
585
- )
586
- self ._bootstrap = True
587
- else :
588
- self ._bootstrap = self .bootstrap
589
-
590
547
# Validate or convert input data
591
548
if issparse (y ):
592
549
raise ValueError ("sparse multilabel-indicator for y is not supported." )
@@ -657,7 +614,7 @@ def fit(self, X, y, sample_weight=None):
657
614
if getattr (y , "dtype" , None ) != DOUBLE or not y .flags .contiguous :
658
615
y_encoded = np .ascontiguousarray (y_encoded , dtype = DOUBLE )
659
616
660
- if isinstance (self ._sampling_strategy , dict ):
617
+ if isinstance (self .sampling_strategy , dict ):
661
618
self ._sampling_strategy = {
662
619
np .where (self .classes_ [0 ] == key )[0 ][0 ]: value
663
620
for key , value in check_sampling_strategy (
@@ -667,7 +624,7 @@ def fit(self, X, y, sample_weight=None):
667
624
).items ()
668
625
}
669
626
else :
670
- self ._sampling_strategy = self ._sampling_strategy
627
+ self ._sampling_strategy = self .sampling_strategy
671
628
672
629
if expanded_class_weight is not None :
673
630
if sample_weight is not None :
@@ -683,7 +640,7 @@ def fit(self, X, y, sample_weight=None):
683
640
# Check parameters
684
641
self ._validate_estimator ()
685
642
686
- if not self ._bootstrap and self .oob_score :
643
+ if not self .bootstrap and self .oob_score :
687
644
raise ValueError ("Out of bag estimation only available if bootstrap=True" )
688
645
689
646
random_state = check_random_state (self .random_state )
@@ -735,7 +692,7 @@ def fit(self, X, y, sample_weight=None):
735
692
delayed (_local_parallel_build_trees )(
736
693
s ,
737
694
t ,
738
- self ._bootstrap ,
695
+ self .bootstrap ,
739
696
X ,
740
697
y_encoded ,
741
698
sample_weight ,
0 commit comments