-
Notifications
You must be signed in to change notification settings - Fork 155
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
introduce MockTransformer to be a placeholder during deprecation
- Loading branch information
1 parent
6d4e126
commit b42f4e3
Showing
3 changed files
with
58 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
from aeon.transformations.base import BaseTransformer | ||
|
||
|
||
class MockTransformer(BaseTransformer): | ||
"""Mock transformer to alter data. | ||
Parameters | ||
---------- | ||
power : int or float, default=0.5 | ||
The power to raise the input timeseries to. | ||
Attributes | ||
---------- | ||
power : int or float | ||
User supplied power. | ||
offset : int or float, or iterable. | ||
User supplied offset value. | ||
Scalar or 1D iterable with as many values as X columns in transform. | ||
""" | ||
|
||
_tags = { | ||
"input_data_type": "Series", | ||
# what is the abstract type of X: Series, or Panel | ||
"output_data_type": "Series", | ||
"X_inner_type": ["pd.DataFrame", "pd.Series"], | ||
"fit_is_empty": True, | ||
"transform-returns-same-time-index": True, | ||
"capability:multivariate": True, | ||
"capability:inverse_transform": True, | ||
} | ||
|
||
def __init__(self, power=0.5): | ||
self.power = power | ||
|
||
if not isinstance(self.power, (int, float)): | ||
raise ValueError( | ||
f"Expected `power` to be int or float, but found {type(self.power)}." | ||
) | ||
super().__init__() | ||
|
||
def _transform(self, X, y=None): | ||
"""Transform X and return a transformed version.""" | ||
return X.pow(self.power) | ||
|
||
def _inverse_transform(self, X, y=None): | ||
"""Reverse transformation on `X`.""" | ||
return X.pow(1.0 / self.power) | ||
|
||
@classmethod | ||
def get_test_params(cls, parameter_set="default"): | ||
"""Return testing parameter settings for the estimator.""" | ||
return {"power": 2.5, "offset": 1} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters