Registry / ai-ml / tbats
library1.1.3pypypi✓ verified 22d ago

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.

pip install tbats
INSTALL
IMPORT
SIG · TBATS
T
tbats
ai-mlpythonv1.1.3
Install
18.8s avg
Import
6400ms
Disk
442MB
Pass rate
5/ 10
Env Coverage5 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v1.1.3 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
build_error
glibc
py 3.103.95 runs
installs and imports cleanly · install 18.8s · import 5.120s · 427MB
442MB installed
● package 442MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

TBATS
from tbats import TBATS

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.

import numpy as np from tbats import TBATS # Generate some example time series data with seasonality np.random.seed(42) n_points = 100 seasonal_period = 24 # Daily seasonality t = np.arange(n_points) y = 50 + 2 * t + 10 * np.sin(2 * np.pi * t / seasonal_period) + np.random.normal(0, 5, n_points) # Create and fit the TBATS model estimator = TBATS(seasonal_periods=[seasonal_period], use_box_cox=True, use_trend=True, use_damped_trend=False, use_arma_errors=True, n_jobs=1) model = estimator.fit(y) # Make a forecast forecast = model.forecast(steps=10) print("Original series (last 5 points):", y[-5:]) print("Forecasted values (next 10 steps):", forecast)
Debug
Known issues
gotchaPrior to version 1.1.3, numeric precision issues could cause Box-Cox transformations to fail or produce incorrect results in certain scenarios.
fix
Upgrade to tbats version 1.1.3 or higher to resolve Box-Cox precision issues.
affects: <1.1.3
breakingIn 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.
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.
affects: >=1.1.0
gotchaVersions 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.
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.
affects: <1.0.6
gotchaWhen `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.
fix
Upgrade to tbats version 1.0.9 or higher to ensure that `n_jobs=1` correctly disables all subprocess spawning.
affects: <1.0.9
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'tbats'
The 'tbats' package is not installed in the Python environment.
fix
Install the package using 'pip install tbats'.
ImportError: cannot import name 'TBATS' from 'tbats'
The 'tbats' package is installed, but the import statement is incorrect.
fix
Use 'from tbats import TBATS' to import the TBATS class.
ValueError: seasonal_periods must be a list of positive numbers
The 'seasonal_periods' parameter is not provided as a list of positive numbers.
fix
Ensure 'seasonal_periods' is a list of positive numbers, e.g., 'seasonal_periods=[7, 365.25]'.
TypeError: fit() missing 1 required positional argument: 'y'
The 'fit' method is called without providing the time series data.
fix
Call 'fit' with the time series data, e.g., 'fitted_model = estimator.fit(y)'.
AttributeError: 'TBATS' object has no attribute 'forecast'
The 'forecast' method is called on an unfitted 'TBATS' object.
fix
Fit the model before forecasting, e.g., 'fitted_model = estimator.fit(y)' followed by 'y_forecasted = fitted_model.forecast(steps=14)'.
Upgrade
Version history
1.1.3latest on PyPI · released Apr 17, 2023
Audit
Dependencies
numpyrequiredNumerical operations and array handling.
scipyrequiredScientific computing, optimization, and statistical functions.
statsmodelsrequiredStatistical modeling framework, used for core time series components.
joblibrequiredFor parallel processing functionality (n_jobs > 1).
Agent activity
15 hits · last 30 days
node
13
OpenAI (training)
1
Resources
tbats — pip install tbats · libregistry