{"id":8565,"library":"pyts","title":"pyts","description":"pyts is a Python package dedicated to time series classification. It provides preprocessing and utility tools, along with implementations of various time series classification algorithms. The library maintains an active development status, with major versions often introducing new Python support and algorithms, currently at version 0.13.0.","status":"active","version":"0.13.0","language":"en","source_language":"en","source_url":"https://github.com/johannfaouzi/pyts","tags":["time-series","classification","machine-learning","preprocessing","transformation"],"install":[{"cmd":"pip install pyts","lang":"bash","label":"Install stable version"}],"dependencies":[{"reason":"Numerical operations and array handling.","package":"NumPy","optional":false},{"reason":"Scientific computing functionalities.","package":"SciPy","optional":false},{"reason":"Machine learning base estimators and utilities; pyts API is heavily inspired by scikit-learn.","package":"Scikit-Learn","optional":false},{"reason":"For parallel processing and caching.","package":"Joblib","optional":false},{"reason":"For high-performance numerical operations.","package":"Numba","optional":false}],"imports":[{"symbol":"TimeSeriesForest","correct":"from pyts.classification import TimeSeriesForest"},{"note":"The BagOfWords algorithm was reworked in v0.11.0; its former version is now available as WordExtractor.","wrong":"from pyts.bag_of_words import BagOfWords # for pre-v0.11.0 behavior","symbol":"BagOfWords","correct":"from pyts.bag_of_words import BagOfWords"},{"note":"Introduced in v0.11.0, containing the functionality of the former BagOfWords.","symbol":"WordExtractor","correct":"from pyts.bag_of_words import WordExtractor"},{"symbol":"load_gunpoint","correct":"from pyts.datasets import load_gunpoint"},{"symbol":"StandardScaler","correct":"from pyts.preprocessing import StandardScaler"},{"symbol":"BOSS","correct":"from pyts.transformation import BOSS"}],"quickstart":{"code":"import numpy as np\nfrom pyts.datasets import load_gunpoint\nfrom pyts.classification import TimeSeriesForest\n\n# Load the GunPoint dataset\nX_train, X_test, y_train, y_test = load_gunpoint(return_X_y=True)\n\n# Initialize and train the Time Series Forest classifier\nclf = TimeSeriesForest(random_state=43)\nclf.fit(X_train, y_train)\n\n# Evaluate the classifier\naccuracy = clf.score(X_test, y_test)\nprint(f\"Accuracy of TimeSeriesForest: {accuracy:.4f}\")","lang":"python","description":"This quickstart loads the 'GunPoint' dataset, initializes a `TimeSeriesForest` classifier, trains it on the training data, and evaluates its accuracy on the test set. This demonstrates a common workflow for time series classification using `pyts`."},"warnings":[{"fix":"Upgrade your Python interpreter to 3.8 or newer for pyts v0.11.0+, 3.9 or newer for pyts v0.12.0+, and 3.10 or newer for pyts v0.13.0+.","message":"Python 3.7 support was dropped in v0.13.0. Python 3.6 support was dropped in v0.12.0, and Python 3.5 in v0.11.0. Ensure your Python environment meets the current requirements.","severity":"breaking","affected_versions":">=0.11.0"},{"fix":"For the old `BagOfWords` functionality, use `from pyts.bag_of_words import WordExtractor` instead. If you want the new `BagOfWords` behavior, update your code to reflect its new parameters or expected output.","message":"The behavior of the `BagOfWords` algorithm was reworked in v0.11.0. If you relied on the old functionality, it has been moved to a new class, `WordExtractor`.","severity":"breaking","affected_versions":">=0.11.0"},{"fix":"Review custom `pyts`-compatible estimators that directly inherited from `scikit-learn` mixins. Update them to use `pyts`'s own mixin classes or ensure compatibility with `pyts`'s internal mixin implementations.","message":"`pyts` replaced `scikit-learn` mixin classes with its own internal mixin classes in v0.12.0. Custom estimators inheriting from deprecated `sklearn` mixins might encounter issues.","severity":"breaking","affected_versions":">=0.12.0"},{"fix":"Always install `pyts` in a clean virtual environment and allow `pip` to resolve the latest compatible versions of its dependencies. Check the official `pyts` documentation for the exact dependency requirements for your `pyts` version. `pip install pyts` should handle this for the latest version.","message":"Minimal versions of core dependencies (NumPy, SciPy, Scikit-Learn, Joblib, Numba) have been updated significantly in recent releases. Using an older `pyts` with newer dependencies, or a newer `pyts` with older dependencies, can lead to runtime errors or unexpected behavior.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-04-16T00:00:00.000Z","next_check":"2026-07-15T00:00:00.000Z","problems":[{"fix":"Run `pip install pyts` to install the library.","cause":"The `pyts` package has not been installed in the current Python environment.","error":"ModuleNotFoundError: No module named 'pyts'"},{"fix":"For the functionality of `BagOfWords` before v0.11.0, import `WordExtractor` instead: `from pyts.bag_of_words import WordExtractor`. If you intend to use the newer `BagOfWords` functionality, ensure your `pyts` version is 0.11.0 or newer.","cause":"Attempting to import `BagOfWords` expecting its pre-v0.11.0 behavior, or from an incompatible version context.","error":"ImportError: cannot import name 'BagOfWords' from 'pyts.bag_of_words'"},{"fix":"If this error occurs after updating `pyts` to v0.12.0 or newer, verify that any custom classes or integrations are compatible with `pyts`'s new internal mixin structure. It may require updating the custom estimator's inheritance or attributes to align with how `pyts` now defines estimator types internally, rather than directly relying on `sklearn`'s private APIs. Ensure that `pyts` estimators are used as intended within `scikit-learn` pipelines, which are generally supported.","cause":"This can occur when custom `pyts`-compatible estimators or pipelines rely on `scikit-learn`'s internal mixin classes which `pyts` replaced with its own in version 0.12.0. The `_estimator_type` attribute might be expected by `scikit-learn` utilities interacting with `pyts` components, but the internal implementation has changed.","error":"AttributeError: type object 'MyCustomEstimator' has no attribute '_estimator_type'"}]}