fraunhoferportugal / tsfel

An intuitive library to extract features from time series.
https://tsfel.readthedocs.io
BSD 3-Clause "New" or "Revised" License
945 stars 143 forks source link

AttributeError: module 'scipy.stats' has no attribute 'median_absolute_deviation' #123

Closed MislavSag closed 1 year ago

MislavSag commented 2 years ago

Hi,

I have installed tsfel in an empty virtual environment inside Dockerfile:

# install python and packages
RUN apt-get -y install python3 python3-venv python3-pip
RUN python3 -m venv /home/rstudio/venv
RUN /home/rstudio/venv/bin/pip3 install --upgrade pip setuptools wheel
RUN /home/rstudio/venv/bin/pip3 install tsfel

When I want to extract all features, I get an error:

! AttributeError: module 'scipy.stats' has no attribute 'median_absolute_deviation'
MislavSag commented 2 years ago

On this site: https://github.com/scipy/scipy/releases/tag/v1.9.0

it says

Removed stats.median_absolute_deviation

Maybe the package doesn't work with scipy 1.9.0 and above ?

dmfolgado commented 2 years ago

Hi! Correct, the latest scipy stable released has changed the name to scipy.stats.median_abs_deviation. We'll look onto this. For now I recommend that you downgrade the scipy release (e.g. pip install scipy==1.8.1).

ErikHodges commented 2 years ago

Hi! Correct, the latest scipy stable released has changed the name to scipy.stats.median_abs_deviation. We'll look onto this. For now I recommend that you downgrade the scipy release (e.g. pip install scipy==1.8.1).

To fix this, I changed line 661 of the '\tsfel\feature_extraction\features.py' script from:

return scipy.stats.median_absolute_deviation(signal, scale=1) --to-- return scipy.stats.median_abs_deviation(signal, scale=1)

Hope this helps!

sp435 commented 1 year ago

Restarted the system after making the change. It works. Thank you!

mluacnunes commented 1 year ago

Updated on new release v0.1.5