27
27
_fit_context ,
28
28
)
29
29
from .metrics .pairwise import KERNEL_PARAMS , PAIRWISE_KERNEL_FUNCTIONS , pairwise_kernels
30
- from .utils import check_random_state , deprecated
30
+ from .utils import check_random_state
31
31
from .utils ._param_validation import Interval , StrOptions
32
32
from .utils .extmath import safe_sparse_dot
33
33
from .utils .validation import (
@@ -600,13 +600,6 @@ class AdditiveChi2Sampler(TransformerMixin, BaseEstimator):
600
600
601
601
Attributes
602
602
----------
603
- sample_interval_ : float
604
- Stored sampling interval. Specified as a parameter if `sample_steps`
605
- not in {1,2,3}.
606
-
607
- .. deprecated:: 1.3
608
- `sample_interval_` serves internal purposes only and will be removed in 1.5.
609
-
610
603
n_features_in_ : int
611
604
Number of features seen during :term:`fit`.
612
605
@@ -693,37 +686,14 @@ def fit(self, X, y=None):
693
686
X = self ._validate_data (X , accept_sparse = "csr" )
694
687
check_non_negative (X , "X in AdditiveChi2Sampler.fit" )
695
688
696
- # TODO(1.5): remove the setting of _sample_interval from fit
697
- if self .sample_interval is None :
698
- # See figure 2 c) of "Efficient additive kernels via explicit feature maps"
699
- # <http://www.robots.ox.ac.uk/~vedaldi/assets/pubs/vedaldi11efficient.pdf>
700
- # A. Vedaldi and A. Zisserman, Pattern Analysis and Machine Intelligence,
701
- # 2011
702
- if self .sample_steps == 1 :
703
- self ._sample_interval = 0.8
704
- elif self .sample_steps == 2 :
705
- self ._sample_interval = 0.5
706
- elif self .sample_steps == 3 :
707
- self ._sample_interval = 0.4
708
- else :
709
- raise ValueError (
710
- "If sample_steps is not in [1, 2, 3],"
711
- " you need to provide sample_interval"
712
- )
713
- else :
714
- self ._sample_interval = self .sample_interval
689
+ if self .sample_interval is None and self .sample_steps not in (1 , 2 , 3 ):
690
+ raise ValueError (
691
+ "If sample_steps is not in [1, 2, 3],"
692
+ " you need to provide sample_interval"
693
+ )
715
694
716
695
return self
717
696
718
- # TODO(1.5): remove
719
- @deprecated ( # type: ignore
720
- "The ``sample_interval_`` attribute was deprecated in version 1.3 and "
721
- "will be removed 1.5."
722
- )
723
- @property
724
- def sample_interval_ (self ):
725
- return self ._sample_interval
726
-
727
697
def transform (self , X ):
728
698
"""Apply approximate feature map to X.
729
699
@@ -744,29 +714,24 @@ def transform(self, X):
744
714
check_non_negative (X , "X in AdditiveChi2Sampler.transform" )
745
715
sparse = sp .issparse (X )
746
716
747
- if hasattr (self , "_sample_interval" ):
748
- # TODO(1.5): remove this branch
749
- sample_interval = self ._sample_interval
750
-
751
- else :
752
- if self .sample_interval is None :
753
- # See figure 2 c) of "Efficient additive kernels via explicit feature maps" # noqa
754
- # <http://www.robots.ox.ac.uk/~vedaldi/assets/pubs/vedaldi11efficient.pdf>
755
- # A. Vedaldi and A. Zisserman, Pattern Analysis and Machine Intelligence, # noqa
756
- # 2011
757
- if self .sample_steps == 1 :
758
- sample_interval = 0.8
759
- elif self .sample_steps == 2 :
760
- sample_interval = 0.5
761
- elif self .sample_steps == 3 :
762
- sample_interval = 0.4
763
- else :
764
- raise ValueError (
765
- "If sample_steps is not in [1, 2, 3],"
766
- " you need to provide sample_interval"
767
- )
717
+ if self .sample_interval is None :
718
+ # See figure 2 c) of "Efficient additive kernels via explicit feature maps" # noqa
719
+ # <http://www.robots.ox.ac.uk/~vedaldi/assets/pubs/vedaldi11efficient.pdf>
720
+ # A. Vedaldi and A. Zisserman, Pattern Analysis and Machine Intelligence, # noqa
721
+ # 2011
722
+ if self .sample_steps == 1 :
723
+ sample_interval = 0.8
724
+ elif self .sample_steps == 2 :
725
+ sample_interval = 0.5
726
+ elif self .sample_steps == 3 :
727
+ sample_interval = 0.4
768
728
else :
769
- sample_interval = self .sample_interval
729
+ raise ValueError (
730
+ "If sample_steps is not in [1, 2, 3],"
731
+ " you need to provide sample_interval"
732
+ )
733
+ else :
734
+ sample_interval = self .sample_interval
770
735
771
736
# zeroth component
772
737
# 1/cosh = sech
0 commit comments