Use this file to discover Exa products, pricing, evaluations, comparisons, use cases, agent interfaces, and technical documentation before exploring further.
Python time series forecasting libraries fit models to past observations and predict future values with uncertainty intervals. A statistical forecaster fits models such as ARIMA or exponential smoothing to each input series. These libraries let planning teams and AI agents forecast demand, traffic, and revenue.
Popularity
statsmodels has the most monthly downloads in this comparison, at 40.9M, a count that covers all its statistical modeling.
def _fit(self, y, X, fh):
"""Fit to training data.
Parameters
---------- y : pd.Series
Target time series to which to fit the forecaster.
fh : int, list, np.array or ForecastingHorizon, optional (default=None)
The forecasters horizon with the steps ahead to predict.
X : pd.DataFrame, optional (default=None)
Exogenous variables are ignored
Returns
------- self : returns an instance of self.
"""
self._cur_y = y
self._cur_X = X
if X is not None:
X = X.loc[y.index]
# statsmodels >= 0.15 raises on out-of-sample prediction if the index # is not supported, e.g., an integer index not starting at 0, # so we pass a RangeIndex in this case. Predictions are re-indexed in _predict. y_fit = y
if pd.api.types.is_integer_dtype(y.index) and not isinstance(
y.index, pd.RangeIndex
):
y_fit = y.reset_index(drop=True)
if X is not None:
X = X.reset_index(drop=True)
self._forecaster = self._instantiate_model()
self._forecaster.fit(y_fit, X=X)
self._y_name = y.name
return self
def build_posterior_dist(
model: tfp.sts.StructuralTimeSeries,
observed_time_series: pd.DataFrame,
parameter_samples: Union[List[tfd.Distribution], Dict[str, tfd.Distribution]],
num_steps_forecast: int
) -> tfd.Distribution: # pragma: no cover
"""
Builds the distribution for post-intervention data given samples from the
posterior `P(z | y)`.
Args
---- model: tfp.StructuralTimeSeries
observed_time_series: pd.DataFrame
Corresponds to the `y` value.
parameter_samples: Union[List[tfd.Distribution], Dict[str, tfd.Distribution]]
samples from the posterior for each state component in `model`.
num_steps_forecast: int
How many time steps to forecast into the future. These will be compared against
the real value of `y` to extract the estimation of impact.
Returns
------- posterior_dist: tfd.Distribution
"""
return tfp.sts.forecast(
model=model,
observed_time_series=observed_time_series,
parameter_samples=parameter_samples,
num_steps_forecast=num_steps_forecast
)
sktime
Provides a unified framework for machine learning with time series.
from sktime.datasets import load_airline
from sktime.forecasting.naive import NaiveForecaster
y = load_airline()
forecaster = NaiveForecaster(strategy='last')
forecaster.fit(y)
forecast = forecaster.predict(fh=[1, 2, 3])
print(forecast)
FAQ
Prophet suits forecasts with nonlinear trends, seasonality, and holiday effects. StatsForecast suits ARIMA, ETS, and Theta models fitted across many series. Chronos suits pretrained forecasting models. statsmodels suits classical statistical models.
StatsForecast provides statistical forecasting models including ARIMA, ETS, CES, and Theta. It fits each specified model to each input series.
Prophet fits time series forecasts with nonlinear trends, seasonality, and holiday effects. It expects a dataframe with ds timestamps and numerical y observations.
sktime is a unified framework for machine learning with time series.
pmdarima selects ARIMA models automatically, as the Python equivalent of the forecast package's auto.arima.
For coding agents
Found your time series forecasting library? Help your agent use it.
Connect Exa so your coding agent can find the library’s documentation, check its API, and look up implementations while you build.