Skip to content

Commit

Permalink
Deprecate BaseDeepClassifier convert_y_to_keras
Browse files Browse the repository at this point in the history
`convert_y_to_keras` should not be a public method, as disDeprecate
BaseDeepClassifier convert_y_to_keras

`convert_y_to_keras` should not be a public method, as explained in
d1a8029. This change issues a
deprecation warning when the method is called and delegates to the
private method, which is used by all deriving classes. The deprecation
message starts with "WARNING" to match the other deprecation message in
the modified file.
  • Loading branch information
cedricdonie committed May 26, 2024
1 parent caab7ae commit 77edad3
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions sktime/classification/deep_learning/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
The reason for this class between BaseClassifier and deep_learning classifiers is
because we can generalise tags, _predict and _predict_proba
"""

__author__ = ["James-Large", "ABostrom", "TonyBagnall", "aurunmpegasus", "achieveordie"]
__all__ = ["BaseDeepClassifier"]

Expand Down Expand Up @@ -122,6 +123,18 @@ def _convert_y_to_keras(self, y):
y = self.onehot_encoder.fit_transform(y)
return y

def convert_y_to_keras(self, y):
"""Convert y to required Keras format."""
from sktime.utils.warnings import warn

warn(
"WARNING: convert_y_to_keras of sktime deep learning estimators is"
"deprecated and will be removed in 0.31.0. For equivalent behaviour,"
"please use sklearn OneHotEncoder.fit_transform directly.",
obj=self,
)
return self._convert_y_to_keras(y=y)

def __getstate__(self):
"""Get Dict config that will be used when a serialization method is called.
Expand Down

0 comments on commit 77edad3

Please sign in to comment.