Comments (12)
@arturdaraujo Just separate the matrixprofile
requirement from the rest. I'll try creating a PR if I'll get to it later. Otherwise, good job!
Also, you could simply import the package normally, but wrap this with try: ... except ImportError: ...
without using importlib
. Again, I'll try to do it later on.
from tsfresh.
Let's help @kempa-liehr fix this.
SOLUTIONS:
- Make matrixprofile package's installation optional using extras_require in the setup.py
- Implement stumpy instead of matrixprofile.
Anyone familiar on how to use extras_require in the setup.py to make matrixprofile optional? Anyone able to post a code that would replace matrixprofile functions on tsfresh? I will have a go and post it here
@erezinman @aiwalter @PJPRoche @williamgilpin @enrique-wesper
from tsfresh.
PR has been merged and a new version 0.20.0 released :)
(if you still see issues, please let us know by!)
Thank you for your time and effort!
from tsfresh.
This package is stuck on Python 3.8 until solving this bug, we are all waiting for this fix. This issue was posted before on #972 and #984
from tsfresh.
Making matrixprofile package optional:
- Changes on: setup.py
For making matrixprofile optional, the setup.py solution is like this:
import sys
from setuptools import find_packages, setup
with open("README.md") as f:
long_description = f.read()
with open("requirements.txt") as f:
requirements = [line for line in f if not line.startswith("#")]
needs_sphinx = {"build_sphinx", "upload_docs"}.intersection(sys.argv)
sphinx = ["sphinx", "sphinx_rtd_theme"] if needs_sphinx else []
simple_requirements = [r for r in requirements if r != "matrixprofile>=1.1.10,<2.0.0"]
advanced_requirements = [r for r in requirements if r == "matrixprofile>=1.1.10,<2.0.0"]
setup(
use_scm_version=True,
long_description=long_description,
long_description_content_type="text/markdown",
setup_requires=["setuptools_scm"] + sphinx,
packages=find_packages(exclude=["tests.*", "tests"]),
extras_require={
"advanced": advanced_requirements, # Advanced features
"simple": simple_requirements, # Basic features
}
)
- Changes on: feature_extraction/feature_calculators.py
Note: "matrix_profile" is a tsfresh function, while "matrixprofile" is the outdated package in question.
The function "matrix_profile" from feature_calculators.py script will still try to import it. The solution is to check if matrixprofile package is installed before importing it. I suggest making the following changes.
import importlib.util
package = "matrixprofile"
is_present = importlib.util.find_spec(package)
if is_present is not None:
import matrixprofile as mp
And
if is_present is not None:
@set_property("fctype", "combiner")
def matrix_profile(x, param):
"""
Calculates the 1-D Matrix Profile[1] and returns...
"""
[...]
return [(key, value) for key, value in res.items()]
- Changes on: across tsfresh package
After the implementation on feature_calculators.py, the only thing needed would be to place a if is_present is not None:
on where matrix_profile is called across tsfresh package.
Calling importlib.util.find_spec(package)
is fast but you could make it faster by simply using from ...feature_extraction.feature_calculators import is_present
, this will help scale on big data. and will call importlib.util.find_spec(package)
only once.
I hope this answer is clear enough to give a sense of how to fix this. If it is too convoluted or it could be improved please point it out.
@kempa-liehr @erezinman @aiwalter @PJPRoche @williamgilpin @enrique-wesper @mmp3 @bvanelli
References:
- https://stackoverflow.com/questions/62713525/declare-optional-dependencies-within-extras-require
- https://www.codespeedy.com/how-to-check-if-a-python-package-is-installed/#:~:text=Using%20the%20import%20keyword%20in,to%20do%20the%20same%20thing.
- https://stackoverflow.com/questions/19289171/importing-a-variable-from-one-python-script-to-another
from tsfresh.
I also think try: ... except ImportError: ...
is a much better solution now that you mentioned it, no need for using importlib.
Thanks for the reply
from tsfresh.
I just realized that there is a PR #985
Can you guys also check if that's adequate? It seems pretty good to me
@kempa-liehr @erezinman @aiwalter @PJPRoche @williamgilpin @enrique-wesper @mmp3 @bvanelli @michaelosthege
from tsfresh.
@nils-braun great! should we also update it here?
Lines 10 to 30 in d059eec
from tsfresh.
Thanks @aiwalter ! I have added py 3.10 as a classifier. I have not added an upper bound to the python_requires
as the ´tsfresh´ package itself has no limitation on it (some dependencies might have though).
Also, I have not added a 3.11 classifier as currently the dependencies will not allow tsfresh to be installed on py 3.11.
from tsfresh.
@nils-braun I still cannot use tsfresh with python 3.10.9. I am getting the following error:
ModuleNotFoundError: TSFreshFeatureExtractor requires python version to be <3.10, but system python version is 3.10.9 (v3.10.9:1dd9be6584, Dec 6 2022, 14:37:36) [Clang 13.0.0 (clang-1300.0.29.30)].
I am using the main branch with latest commit 2e49614
from tsfresh.
Hi @ElreboCM - it looks like you are not using tsfresh directly, but maybe via the aeon toolkit by @aiwalter? Because TSFreshFeatureExtractor
sounds like it. So maybe there is another layer which prevents you from using it? The version constraint in tsfresh is removed though.
from tsfresh.
Indeed I was importing from sktime
from sktime.transformations.panel.tsfresh import TSFreshFeatureExtractor
from tsfresh.
Related Issues (20)
- shuffle_transfer failed during shuffle c1992000bcde9deee65a2332ab4614a2 HOT 3
- Can Not Rolling With Binary Feature HOT 2
- tsfresh 0.20.0: TypeError exception with Pandas 2.0.0 HOT 3
- support of python 3.10 HOT 2
- Debugging tsfresh methods from Notebook freezes whole process HOT 4
- Example Provided in doc doesn't work HOT 1
- Quick start example fails due to TypeError in Setting MultiIndex HOT 1
- During the feature extraction process, how could I set the param from a subset of another columns. HOT 1
- TypeError: acf() got an unexpected keyword argument 'unbiased' HOT 11
- 05 Timeseries Forecasting (multiple ids).ipynb doesn't work as written HOT 2
- Problem with the function extract_features HOT 7
- Feature calculator return type documentation HOT 2
- extract_relevant_features hangs on specific data HOT 1
- number_of_maxima only returns maxima of last key in the dictionary. HOT 2
- Feature selection taking magnitutes longer than it should HOT 8
- Look-Ahead Bias in Generated Features HOT 4
- id column in the result of make_forecasting_frame have only (id, ?) as identifier HOT 4
- roll time series only give "step by step window" for max_timeshift window, but have left alone windows from 1 to max_timeshift window? HOT 1
- Cannot run dask_feature_extraction_on_chunk
- AttributeError: `np.PINF` was removed in the NumPy 2.0 release. Use `np.inf` instead. HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tsfresh.