{"id":4260,"library":"sktime","title":"sktime: Unified Framework for Time Series Machine Learning","description":"sktime is a Python library for machine learning with time series. It provides a unified interface for various time series tasks, including forecasting, classification, regression, and transformation. It integrates seamlessly with `scikit-learn` and offers a modular architecture for building complex time series pipelines. The project is actively maintained with frequent minor and patch releases, typically every few weeks.","status":"active","version":"0.40.1","language":"en","source_language":"en","source_url":"https://github.com/sktime/sktime","tags":["time-series","machine-learning","forecasting","classification","regression","transformers","scikit-learn-compatible"],"install":[{"cmd":"pip install sktime","lang":"bash","label":"Basic installation"},{"cmd":"pip install sktime[all_extras]","lang":"bash","label":"Full installation with all optional dependencies"},{"cmd":"pip install sktime[forecasting]","lang":"bash","label":"Installation with forecasting-specific dependencies"}],"dependencies":[{"reason":"Core dependency for API compatibility and transformers.","package":"scikit-learn","optional":false},{"reason":"Core numerical operations.","package":"numpy","optional":false},{"reason":"Data handling.","package":"pandas","optional":false},{"reason":"Many classical forecasting models and statistical tests.","package":"statsmodels","optional":true},{"reason":"Auto ARIMA forecasting.","package":"pmdarima","optional":true},{"reason":"Performance critical operations for some estimators.","package":"numba","optional":true},{"reason":"Deep learning models (e.g., InceptionTime, LSTMForecaster).","package":"tensorflow","optional":true},{"reason":"Deep learning models (e.g., ChronosForecaster, TinyTimeMixerForecaster).","package":"torch","optional":true}],"imports":[{"note":"Users often mistake `model_selection` for base estimator imports. Estimators are generally in `sktime.<task>.<model_name>`.","wrong":"from sktime.forecasting.model_selection import ForecastingGridSearchCV","symbol":"Forecaster","correct":"from sktime.forecasting.base import BaseForecaster"},{"symbol":"ThetaForecaster","correct":"from sktime.forecasting.theta import ThetaForecaster"},{"symbol":"temporal_train_test_split","correct":"from sktime.forecasting.model_selection import temporal_train_test_split"},{"symbol":"StandardScaler","correct":"from sktime.transformations.series.scaling import StandardScaler"}],"quickstart":{"code":"import pandas as pd\nfrom sktime.forecasting.model_selection import temporal_train_test_split\nfrom sktime.forecasting.theta import ThetaForecaster\nfrom sktime.utils.plotting import plot_series # requires 'matplotlib' optional dependency\n\n# 1. Data loading and splitting\ny = pd.Series([10, 12, 13, 15, 18, 20, 22, 25, 28, 30])\ny.index = pd.to_datetime(pd.date_range(\"2020-01-01\", periods=10, freq=\"M\"))\ny_train, y_test = temporal_train_test_split(y, test_size=3)\n\n# 2. Model selection and fitting\nforecaster = ThetaForecaster(sp=1)\nforecaster.fit(y_train)\n\n# 3. Prediction\nfh = [1, 2, 3]  # forecast horizon for next 3 periods\ny_pred = forecaster.predict(fh=fh)\n\nprint(\"Training data:\\n\", y_train)\nprint(\"Test data:\\n\", y_test)\nprint(\"Predictions:\\n\", y_pred)\n\n# To plot, ensure matplotlib is installed (pip install matplotlib)\n# plot_series(y_train, y_test, y_pred, labels=[\"y_train\", \"y_test\", \"y_pred\"])","lang":"python","description":"This quickstart demonstrates a basic time series forecasting workflow using `sktime`. It covers data preparation, model initialization, fitting, and prediction with the `ThetaForecaster`. Note that plotting requires the `matplotlib` library, which is an optional dependency."},"warnings":[{"fix":"Install `sktime` with specific extras, e.g., `pip install sktime[forecasting]` or `pip install sktime[all_extras]` to ensure all necessary dependencies for your desired models are present.","message":"sktime relies heavily on 'soft dependencies'. Many estimators (especially advanced or classical statistical models) require additional packages that are not installed by default with `pip install sktime`. Attempting to use these estimators without their dependencies will result in `ModuleNotFoundError` or similar.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Always check the official `sktime` changelog and release notes when upgrading versions. Pay close attention to deprecation warnings in your code and update your imports/API calls accordingly.","message":"sktime undergoes regular API refinements and deprecations. Features, classes, or functions marked for deprecation in one release are often removed in subsequent major/minor releases (e.g., 0.38.0, 0.39.0 introduced scheduled deprecations).","severity":"breaking","affected_versions":"0.38.x, 0.39.x, 0.40.x and newer"},{"fix":"Ensure your Python environment meets the `sktime`'s `requires_python` specification. Use a virtual environment to manage dependencies and Python versions.","message":"sktime has specific Python version requirements (currently `>=3.10, <3.15`). Using an unsupported Python version can lead to installation issues or runtime errors, particularly with dependencies.","severity":"gotcha","affected_versions":"All versions after 0.39.x"},{"fix":"If encountering issues after a `scikit-learn` upgrade, check `sktime`'s latest patch releases for compatibility fixes. Consider pinning `scikit-learn` to a known compatible version in production environments.","message":"Compatibility with `scikit-learn` versions can be sensitive. Hotfixes are frequently released to address `scikit-learn` version updates (e.g., 0.38.1 for `scikit-learn 1.7`).","severity":"gotcha","affected_versions":"All versions, particularly sensitive to new `scikit-learn` releases."}],"env_vars":null,"last_verified":"2026-04-11T00:00:00.000Z","next_check":"2026-07-10T00:00:00.000Z"}