-
-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Feature Request] Integration with pyts #56
Comments
The following snippet creates a wrapper method for from tflex.features.utils import _get_funcwrapper_func_and_kwargs
def transformer_wrapper(transformer) -> FuncWrapper:
from sklearn.base import TransformerMixin
# assert isinstance(transformer, FuncWrapper) or isinstance(transformer, TransformerMixin)
func_wrapper_kwargs = {}
if isinstance(transformer, FuncWrapper):
# Extract the function and keyword arguments from the function wrapper
transformer, func_wrapper_kwargs = _get_funcwrapper_func_and_kwargs(transformer)
assert hasattr(transformer, "fit") and hasattr(transformer, "transform")
func_wrapper_kwargs["vectorized"] = True
def wrap_transformer(X):
try:
res = transformer.transform(X)
print("Transforming")
return res
except:
print("Fitting + Transforming")
return transformer.fit_transform(X)
wrap_transformer.__name__ = "[wrapped_transformer]__" + transformer.__repr__()
return FuncWrapper(wrap_transformer, **func_wrapper_kwargs) I did not add this method to the collection of wrappers in
The code snippet is perfectly fine to use in the Example of correct usage of the above wrapper; from tsflex.features import FuncWrapper, FeatureDescriptor, FeatureCollection
from pyts.transformation import ROCKET
fc_rocket = FeatureCollection(
feature_descriptors=[
FeatureDescriptor(
function=transformer_wrapper(
FuncWrapper(
ROCKET(100),
output_names=[f"rocket_{i}" for i in range(200)] # each kernel outputs 2 values
)
),
window=60, stride=60, series_name=sensor
) for sensor in sensors
]
) PS: other suggestions for an implementation are welcome 😄 Cheers, |
pyts contains some cool feature extractors such as WEASEL & BOSS that are quite unique to that package. A wrapper around pyts would be a nice addition!
The BOSS is concerned with time series classification in the presence of noise
Fast and Accurate Time Series Classification with WEASEL
The text was updated successfully, but these errors were encountered: