{"id":4798,"library":"tbats","title":"TBATS for Time Series Forecasting","description":"tbats is a Python library implementing BATS and TBATS models for time series forecasting, known for handling complex seasonality and Box-Cox transformations. The current version is 1.1.3, and it receives updates primarily for bug fixes, dependency upgrades, and occasional feature enhancements, with an irregular release cadence.","status":"active","version":"1.1.3","language":"en","source_language":"en","source_url":"https://github.com/intive-DataScience/tbats","tags":["time series","forecasting","tbats","bats","seasonality","box-cox"],"install":[{"cmd":"pip install tbats","lang":"bash","label":"Install tbats"}],"dependencies":[{"reason":"Numerical operations and array handling.","package":"numpy","optional":false},{"reason":"Scientific computing, optimization, and statistical functions.","package":"scipy","optional":false},{"reason":"Statistical modeling framework, used for core time series components.","package":"statsmodels","optional":false},{"reason":"For parallel processing functionality (n_jobs > 1).","package":"joblib","optional":false}],"imports":[{"symbol":"TBATS","correct":"from tbats import TBATS"}],"quickstart":{"code":"import numpy as np\nfrom tbats import TBATS\n\n# Generate some example time series data with seasonality\nnp.random.seed(42)\nn_points = 100\nseasonal_period = 24 # Daily seasonality\nt = np.arange(n_points)\ny = 50 + 2 * t + 10 * np.sin(2 * np.pi * t / seasonal_period) + np.random.normal(0, 5, n_points)\n\n# Create and fit the TBATS model\nestimator = TBATS(seasonal_periods=[seasonal_period],\n                  use_box_cox=True,\n                  use_trend=True,\n                  use_damped_trend=False,\n                  use_arma_errors=True,\n                  n_jobs=1)\nmodel = estimator.fit(y)\n\n# Make a forecast\nforecast = model.forecast(steps=10)\n\nprint(\"Original series (last 5 points):\", y[-5:])\nprint(\"Forecasted values (next 10 steps):\", forecast)","lang":"python","description":"This quickstart demonstrates how to initialize, fit, and forecast with a TBATS model. It generates a sample time series with trend and seasonality, then applies TBATS with Box-Cox transformation and ARMA errors to predict future values. `n_jobs=1` is used to prevent parallel processing in simple examples."},"warnings":[{"fix":"Upgrade to tbats version 1.1.3 or higher to resolve Box-Cox precision issues.","message":"Prior to version 1.1.3, numeric precision issues could cause Box-Cox transformations to fail or produce incorrect results in certain scenarios.","severity":"gotcha","affected_versions":"<1.1.3"},{"fix":"If unexpected behavior related to multiprocessing occurs, explicitly set `multiprocessing_start_method` in the `TBATS` constructor (e.g., `TBATS(..., multiprocessing_start_method='fork')`) to match previous behavior or to 'fork' if that is preferred and supported by your OS.","message":"In version 1.1.0, the default method for spawning new processes for parallel execution (`n_jobs > 1`) was changed from the system default to 'spawn'. This may alter behavior, particularly on Windows or macOS where the default 'fork' method has different implications.","severity":"breaking","affected_versions":">=1.1.0"},{"fix":"Upgrade to tbats version 1.0.6 or higher. If using older versions, ensure your application handles process pool management explicitly or restricts `n_jobs` to 1.","message":"Versions prior to 1.0.6 (and specifically 1.0.5 had fixes) suffered from resource leaks where multiprocessing pools were not reliably closed, potentially leading to 'too many open files' errors or system instability.","severity":"gotcha","affected_versions":"<1.0.6"},{"fix":"Upgrade to tbats version 1.0.9 or higher to ensure that `n_jobs=1` correctly disables all subprocess spawning.","message":"When `n_jobs=1` was specified in versions prior to 1.0.9, subprocesses might still have been triggered, leading to unnecessary overhead or potential issues with environments not configured for multiprocessing.","severity":"gotcha","affected_versions":"<1.0.9"}],"env_vars":null,"last_verified":"2026-04-12T00:00:00.000Z","next_check":"2026-07-11T00:00:00.000Z"}