wwrechard/pydlm

A python library for Bayesian time series modeling

What it solves

PyDLM is a Python library designed for time series modeling. It provides a flexible framework for analyzing and forecasting time series data by decomposing them into various components like trends and seasonality, allowing users to handle complex patterns and improve prediction accuracy.

How it works

The library is based on Bayesian dynamic linear models (DLMs). It uses a state-space approach to model time series as a sum of components. Users can build models by adding together different components such as:

  • Linear/Quadratic Trends: To capture the general direction of the movement of the data.
  • Seasonality: To capture repeating patterns over a specific period (e.g., weekly or annual).
  • Dynamic Regression: Using the dynamic component to incorporate external predictors (features) that can change over time.

Once a model is defined, it is fitted to the data using forward filtering and backward smoothing to produce filtered results, one-day ahead predictions, and confidence intervals.

Who it’s for

Data scientists and analysts who need to perform Bayesian time series analysis, decomposition, and forecasting in Python, particularly those looking for an alternative to the R package bsts.

Highlights

  • Flexible Model Construction: Models are built by adding components (trend, seasonality, dynamic regression) together using the + operator.
  • Casting to Pandas: Supports pandas input for the dlm and dynamic classes.
  • Fast Inference: Optimized for fast model fitting and inference.
  • Comprehensive Visualization: Built-in plotting functions to visualize fitted results, predictions, and individual components.

Related

  • Project
  • Project
  • Project
  • Project
  • Project