@@ -437,10 +437,10 @@ def __init__(
437437 max_features = "sqrt" ,
438438 max_leaf_nodes = None ,
439439 min_impurity_decrease = 0.0 ,
440- bootstrap = "warn" ,
440+ bootstrap = False ,
441441 oob_score = False ,
442- sampling_strategy = "warn " ,
443- replacement = "warn" ,
442+ sampling_strategy = "all " ,
443+ replacement = True ,
444444 n_jobs = None ,
445445 random_state = None ,
446446 verbose = 0 ,
@@ -498,7 +498,7 @@ def _validate_estimator(self, default=DecisionTreeClassifier()):
498498
499499 self .base_sampler_ = RandomUnderSampler (
500500 sampling_strategy = self ._sampling_strategy ,
501- replacement = self ._replacement ,
501+ replacement = self .replacement ,
502502 )
503503
504504 def _make_sampler_estimator (self , random_state = None ):
@@ -544,49 +544,6 @@ def fit(self, X, y, sample_weight=None):
544544 The fitted instance.
545545 """
546546 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-
590547 # Validate or convert input data
591548 if issparse (y ):
592549 raise ValueError ("sparse multilabel-indicator for y is not supported." )
@@ -657,7 +614,7 @@ def fit(self, X, y, sample_weight=None):
657614 if getattr (y , "dtype" , None ) != DOUBLE or not y .flags .contiguous :
658615 y_encoded = np .ascontiguousarray (y_encoded , dtype = DOUBLE )
659616
660- if isinstance (self ._sampling_strategy , dict ):
617+ if isinstance (self .sampling_strategy , dict ):
661618 self ._sampling_strategy = {
662619 np .where (self .classes_ [0 ] == key )[0 ][0 ]: value
663620 for key , value in check_sampling_strategy (
@@ -667,7 +624,7 @@ def fit(self, X, y, sample_weight=None):
667624 ).items ()
668625 }
669626 else :
670- self ._sampling_strategy = self ._sampling_strategy
627+ self ._sampling_strategy = self .sampling_strategy
671628
672629 if expanded_class_weight is not None :
673630 if sample_weight is not None :
@@ -683,7 +640,7 @@ def fit(self, X, y, sample_weight=None):
683640 # Check parameters
684641 self ._validate_estimator ()
685642
686- if not self ._bootstrap and self .oob_score :
643+ if not self .bootstrap and self .oob_score :
687644 raise ValueError ("Out of bag estimation only available if bootstrap=True" )
688645
689646 random_state = check_random_state (self .random_state )
@@ -735,7 +692,7 @@ def fit(self, X, y, sample_weight=None):
735692 delayed (_local_parallel_build_trees )(
736693 s ,
737694 t ,
738- self ._bootstrap ,
695+ self .bootstrap ,
739696 X ,
740697 y_encoded ,
741698 sample_weight ,
0 commit comments