Skip to content

Ostinato Overwrites Original Time Series #982

@seanlaw

Description

@seanlaw

There appears to be a bug in the ostinato (and variants) algorithm where the list of time series being passed into the function are also (possibly, in some rare cases) being incorrectly overwritten after they have been core.preprocessed:

https://github.com/TDAmeritrade/stumpy/blob/9edd7f50e3e59f7212ca2ce399be075c01872960/stumpy/ostinato.py#L372-L375

This isn't a problem when there are no np.nan/np.inf in the data since the time series that gets passed back will be identical to the input time series. However, in the rare case, when there are np.nan/np.inf in the time series, those parts of the time series get preprocessed into 0.0 and then this converted time series overwrites the original element within the input list of time series Ts.

What we should do is:

  1. make a copy of the input list, Ts, and also each time series, Ts[i], so that the original Ts/Ts[i] is NOT overwritten
  2. Add a unit test to check that the input is not overwritten in Ts (especially when there are np.nan/np.inf in the data

Something like:

Ts_copy = []
for T in Ts:
    Ts_copy.append(T.copy())

and then use Ts_copy everywhere and overwrite where necessary

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions