blue-yonder / tsfresh

Automatic extraction of relevant features from time series:
http://tsfresh.readthedocs.io
MIT License
8.36k stars 1.21k forks source link

Rolling Time Series #342

Closed snowde closed 6 years ago

snowde commented 6 years ago

Rolling Time Series: This did not produce a new id


def roll_out_time_series(time_shift):
        # Shift out only the first "time_shift" rows
        df_temp = grouped_data.shift(time_shift)
        df_temp[column_id] = df[column_sort]
        if column_kind:
            df_temp[column_kind] = df[column_kind]
        return df_temp.dropna()

I changed it to this


def roll_out_time_series(time_shift):
        # Shift out only the first "time_shift" rows
        df_temp = grouped_data.shift(time_shift)
        df_temp[column_id] = df[column_id].map(str) + str(time_shift)
        if column_kind:
            df_temp[column_kind] = df[column_kind]
        return df_temp.dropna()
MaxBenChrist commented 6 years ago

Can you maybe elaborate your issue in a little bit more detail?

Have you seen http://tsfresh.readthedocs.io/en/latest/text/forecasting.html ?

nils-braun commented 6 years ago

What do you mean by creating new IDs? The ID is in our case the name of the column, where the rolling stopped.

snowde commented 6 years ago

Hi Nils,

I didn't quite catch what your function did. Here was my situation.

Had a time series of multiple stock pricing data and had to recalculate tsfresh on all dates, rolling with size k for each consecutive date.

This is what I came up with:

https://paper.dropbox.com/doc/Rolling-x499qLMtLFBzthcrMwQlq?_tk=share_copylink Rollinghttps://paper.dropbox.com/doc/Rolling-x499qLMtLFBzthcrMwQlq?_tk=share_copylink paper.dropbox.com def roll(good,length, sorter, id): # Check to ensure all id's are at least as long as one rolling time series bytag = good.groupby(id).aggregate(np.


From: Nils Braun notifications@github.com Sent: 01 November 2017 21:36:46 To: blue-yonder/tsfresh Cc: snowde; Author Subject: Re: [blue-yonder/tsfresh] Rolling Time Series (#342)

What do you mean by creating new IDs? The ID is in our case the name of the column, where the rolling stopped.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/blue-yonder/tsfresh/issues/342#issuecomment-341033823, or mute the threadhttps://github.com/notifications/unsubscribe-auth/ATXmT6Gjr3tJ2OIPr3Sd852xnOTyEgyuks5syC2dgaJpZM4QHC_E.

nils-braun commented 6 years ago

Hi @snowde,

well, you are of course free to use any other method, if you like :+1: If your method is faster or has a larger use case, you can make a pull request if you want (but I have not looked through it in detail).

As @MaxBenChrist already pointed out, the rolling mechanism is quite well described in our documentation. There, it is also described what happens to the IDs etc.