stumpy-dev/stumpy

core.py AttributeError: 'float' object has no attribute 'copy'

Closed this issue · 3 comments

When using stumpy.ostinato on a list object Ts containing float values, I get an AttributeError. The issue is traced back to T = T.copy() in the _preprocess(T) function in core.py. I have tried preprocessing my list object containing multiple times series joined together as np.ndarray type before passing it through the ostinato function with no success. Using stumpy==1.11.1. Appreciate any suggestions, thanks!

@PatrickKudo Thank you for your question and welcome to the STUMPY community. Can you please provide a simple, reproducible code example that demonstrates your error?

Your data should look like this:

import stumpy
import numpy as np
stumpy.ostinato(
    [np.array([584., -11., 23., 79., 1001., 0., 19.]),
     np.array([600., -10., 23., 17.]),
     np.array([  1.,   9.,  6.,  0.])],
    m=3)

even this works:

stumpy.ostinato(
    [[584., -11., 23., 79., 1001., 0., 19.],
     [600., -10., 23., 17.],
     [  1.,   9.,  6.,  0.]],
     m=3)

Using stumpy==1.11.1

Are you able to update to the latest version of STUMPY?

I think perhaps I am misunderstanding the expected input to ostinato. Is it expecting a list of separate time series like:

Ts = [np.array([0.111, 0.22, 0.33, 0]), np.array([0.4, 0.55, 0.66, 0]), np.array([0.7, 0.888, 0.99, 0])]

Not a list of separate time series joined into one time series as a list? I.e.:

Ts = [0.111, 0.22, 0.33, 0, 0.4, 0.55, 0.66, 0, 0.7, 0.888, 0.99, 0]

If it is not the latter, then I am using it wrong. I was trying to do:

radius, Ts_idx, subseq_idx = stumpy.ostinato([0.111, 0.22, 0.33, 0, 0.4, 0.55, 0.66, 0, 0.7, 0.888, 0.99, 0], 3)

I think perhaps I am misunderstanding the expected input to ostinato. Is it expecting a list of separate time series like:

Yes, that is correct!

Not a list of separate time series joined into one time series as a list? I.e.:

Yes, exactly! It's either a list of lists or a list of numpy arrays as shown above.

Please note that at the bottom of each API function (example), there is usually an "Examples" section that provides a clear working code example that might help