TDAmeritrade / stumpy

STUMPY is a powerful and scalable Python library for modern time series analysis

Home Page:https://stumpy.readthedocs.io/en/latest/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Ts_subseq_isconstant parameter in ostinato algorithm

ogreyesp opened this issue · comments

Hello

I´m working with the stumpy.ostinato algorithm to find consensus motifs. I'm creating a method wherein some subsequences of the timeseries provided to ostinato should not be taken into account. Is that the purpose of Ts_subseq_isconstant parameter?

I´m trying to read the code of the ostinato implementation, but I cannot completely understand what is the purpose of Ts_subseq_isconstant parameter, and also an example using this parameter is not given. Could you help me?

@ogreyesp Thank you for your question and welcome to the STUMPY community.

I'm creating a method wherein some subsequences of the timeseries provided to ostinato should not be taken into account.

If you truly do not care about a subsequence then you have two main options:

  1. You can remove those subsequences from your original time series.
  2. You can manually set the values of those subsequences to np.nan. In STUMPY, any subsequence that contains np.nan/np.inf will have their corresponding distances set to np.nan.

Is that the purpose of Ts_subseq_isconstant parameter?

No, the subseq_isconstant parameter found throughout STUMPY are a way for the user to annotate each subsequences within a time series as "constant" (i.e., are all of the values within the subsequence the same) or not. Due to numerical imprecision, simply checking if the standard deviation within each subsequence is equal to zero is insufficient in some rare cases and so we've provided this parameter to allow for more user control.

@seanlaw Thank you very much.

Now, it is clearer for me. So, in my case, the second option you mentioned (the use of np.nan) is the most suitable.

Best regards

Óscar