Skip to content
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

Implement series-as-features transformers #297

Closed
mloning opened this issue Jun 19, 2020 · 6 comments
Closed

Implement series-as-features transformers #297

mloning opened this issue Jun 19, 2020 · 6 comments
Labels
feature request New feature or request good first issue Good for newcomers implementing algorithms Implementing algorithms, estimators, objects native to sktime

Comments

@mloning
Copy link
Contributor

mloning commented Jun 19, 2020

List of transformations we'd like to include in sktime
see #6 and #224

Describe the solution you'd like
Here's a template for a series-as-features transformer:

from sktime.transformers.series_as_features.base import \
    BaseSeriesAsFeaturesTransformer
from sktime.utils.validation.series_as_features import check_X

class MyTransformer(BaseSeriesAsFeaturesTransformer):
    """MyTransformer docstring
    """

    def __init__(self, my_parameter=10):
        self.my_parameter = my_parameter
        super(MyTransformer, self).__init__()

    def fit(self, X, y=None):
        """
        Fit transformer.

        Parameters
        ----------
        X : pandas DataFrame of shape [n_samples, n_features]
            Input data
        y : pandas Series, shape (n_samples, ...), optional
            Targets for supervised learning.

        Returns
        -------
        self : an instance of self.
        """
        X = check_X(X, enforce_univariate=True)
        # fit transformer
        ...

        self._is_fitted = True
        return self

    def transform(self, X, y=None):
        """
        Transform X.

        Parameters
        ----------
        X : nested pandas DataFrame of shape [n_instances, n_columns]
            Nested dataframe with time-series in cells.

        Returns
        -------
        Xt : pandas DataFrame
        """
        self.check_is_fitted()
        X = check_X(X)

        # Apply transformation on X
        Xt = ...
        return Xt
@mloning mloning added good first issue Good for newcomers feature request New feature or request implementing algorithms Implementing algorithms, estimators, objects native to sktime labels Jun 19, 2020
@Cheukting
Copy link
Contributor

I think I get the input but not sure what to be expected for the return Xt? should it be aggregated or flatten out the time series? Also, is this going to be helping out the issue mentioned? Cannot see the connection there... can you explain a bit more?

@Cheukting
Copy link
Contributor

Cheukting commented Jun 20, 2020

Or do you mean by continuing to add the transformer in #6 (comment) ?

@mloning
Copy link
Contributor Author

mloning commented Jun 20, 2020

The output Xt would be the same format as the input: a nested pd.DataFrame. Yes, so for example, we would like to have a FourierTransformer() which takes in a nested data frame with series in cells and returns a nested data frame with Fourier coefficients in cells (applying the Fourier transform iteratively over all series). Hope this helps!

@ABostrom
Copy link
Contributor

@mloning hi markus. I'm going to pick up some of the issues. Was thinking of doing some work on the transformers list. Getting my dev env r-synced. looking at the truncation transformer right now.

@mloning
Copy link
Contributor Author

mloning commented Jun 22, 2020

@ABostrom sounds good!

@mloning
Copy link
Contributor Author

mloning commented Nov 13, 2020

Closed this in favour of #483

@mloning mloning closed this as completed Nov 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request New feature or request good first issue Good for newcomers implementing algorithms Implementing algorithms, estimators, objects native to sktime
Projects
None yet
Development

No branches or pull requests

3 participants