Registry / ai-ml / pydlm
library0.1.1.13pypypi✓ verified 86d ago

A Python library for Bayesian dynamic linear models (DLMs) for time series analysis. Current version 0.1.1.13, released 2024-07. Supports modeling, filtering, smoothing, and forecasting. Low release cadence, maintenance mode.

pip install pydlm
INSTALL
IMPORT
SIG · PYDLM
P
pydlm
ai-mlpythonv0.1.1.13
Install
7.6s avg
Import
283ms
Disk
181MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.1.1.13 · 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
installs and imports cleanly · install 0.0s · import 0.282s · 178.2MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 7.6s · import 0.284s · 171MB
181MB installed
● package 181MB
Code
Verified usage

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

dlm
from pydlm import dlm
import pydlm
Common mistake: `import pydlm` does not expose the DLM class; you must import `dlm` explicitly.
dlm
from pydlm import dlm
from pydlm.dlm import dlm
The public API is at top-level; `pydlm.dlm` is a submodule, but direct import works.

Basic usage: create a DLM, add components, fit, and forecast.

from pydlm import dlm import numpy as np # Generate sample time series data = [2.0, 2.5, 3.0, 3.5, 4.0] # Create DLM with polynomial trend of order 1 and seasonal component 4 my_dlm = dlm(data) + dlm.trend(1) + dlm.seasonal(4) # Fit the model my_dlm.fit() # One-step ahead predictions predictions = my_dlm.predictN(N=1) print(predictions) # Access filtered states filtered_states = my_dlm.getFilteredObs() print(filtered_states)
Debug
Known issues
gotchaThe library expects 1D list-like data; passing a pandas Series may cause silent errors or shape mismatches.
fix
Convert to list before passing: `data = series.tolist()`.
affects: all
deprecatedThe `dlm.trend()` and `dlm.seasonal()` functions are part of the 'builder' API. Do not confuse with `trend` and `seasonal` as classes.
fix
Use `dlm.trend(degree=1)` and `dlm.seasonal(period=4)` as static methods.
affects: <=0.1.1.13
gotchaMissing component combination: you must add at least one component (trend, seasonal, or dynamic) before fitting; otherwise the model is degenerate.
fix
Always include `dlm.trend(1)` as a minimum.
affects: all
breakingIn version 0.1.1.13, the `printInfo` method was replaced by logging. If you rely on console output being muted, use the new logging configuration.
fix
Adjust logging level: `import logging; logging.getLogger('pydlm').setLevel(logging.WARNING)`.
affects: >=0.1.1.13
Errors
Common errors & fixes
ImportError: cannot import name 'dlm' from 'pydlm'
Outdated package or incorrect import path.
fix
Run `pip install --upgrade pydlm` and use `from pydlm import dlm`.
AttributeError: module 'pydlm' has no attribute 'dlm'
Using `import pydlm` and then `pydlm.dlm`; the class is not exposed at module level.
fix
Use `from pydlm import dlm`.
ValueError: Can not detect multivariate dimension from the data.
Data is not a list of floats or has unexpected dimension (e.g., 2D array).
fix
Pass a simple Python list: `data = list(your_series)`.
Upgrade
Version history
0.1.1.13latest on PyPI · released Aug 13, 2024
Audit
Dependencies

No dependency data recorded yet.

Agent activity
14 hits · last 30 days
node
12
OpenAI (training)
1
Resources
pydlm — pip install pydlm · libregistry