blue-yonder / tsfresh

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

I cannot call some methods that calculates the measures #498

Closed AbufoudaMohammed closed 5 years ago

AbufoudaMohammed commented 5 years ago

I am trying to call the methods that calculate the measures from my code. ( i do that because I am interested in some of the measurs, not all of them)

whenever the function I am calling uses the variable param, i got an error. For example:

print('cwt_coefficients ', f.cwt_coefficients(x,{'widths': 10, 'coeff': 5, "w":10} )) generates the following error:

line 1205, in cwt_coefficients
    widths = parameter_combination["widths"]
TypeError: string indices must be integers

Is there something wrong I am doing? I suspect that there should be specific format for the param value!

MaxBenChrist commented 5 years ago

What do you mean by "measure" ? the feature calculators?

You will have to pass a list of params, as the docstring tells you. It states that argument params needs to be a list.

print('cwt_coefficients ', f.cwt_coefficients(x, [{'widths': 10, 'coeff': 5, "w":10} )])

or

print('cwt_coefficients ', f.cwt_coefficients(x, [{'widths': 10, 'coeff': 5, "w":10} ), {'widths': 3, 'coeff': 5, "w":10} ), {'widths': 10, 'coeff': 5, "w":11} )])

for multiple features

AbufoudaMohammed commented 5 years ago

What do you mean by "measure" ? the feature calculators?

You will have to pass a list of params, as the docstring tells you. It states that argument params needs to be a list.

print('cwt_coefficients ', f.cwt_coefficients(x, [{'widths': 10, 'coeff': 5, "w":10} )])

or

print('cwt_coefficients ', f.cwt_coefficients(x, [{'widths': 10, 'coeff': 5, "w":10} ), {'widths': 3, 'coeff': 5, "w":10} ), {'widths': 10, 'coeff': 5, "w":11} )])

for multiple features

Yes, the feature calculators. The two code lines you put were syntactically incorrect. Do you mean a list of dictionaries? if yes, then when I tried this:

print('cwt_coefficients ', f.cwt_coefficients(x, [{'widths': 10, 'coeff': 5, "w": 10}, {'widths': 3, 'coeff': 5, "w": 10}, {'widths': 10, 'coeff': 5, "w": 11} ]))

i got this error:

File "*****\scipy\signal\wavelets.py", line 360, in cwt output = np.zeros([len(widths), len(data)]) TypeError: object of type 'int' has no len()

is there a specific format for the list of dictionaries that this function (and its sisters) accepts?

MaxBenChrist commented 5 years ago

Sorry, widths need to be a list of ints, so

print('cwt_coefficients ', f.cwt_coefficients(x, [{'widths': [3, 10], 'coeff': 5, "w": 10}, {'widths': [3], 'coeff': 5, "w": 10}, {'widths': [3, 10], 'coeff': 5, "w": 11} ]))
AbufoudaMohammed commented 5 years ago

Thanks, that solved the problem.