{"id":24318,"library":"pydlm","title":"PyDLM","description":"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.","status":"maintenance","version":"0.1.1.13","language":"python","source_language":"en","source_url":"https://github.com/wwrechard/pydlm","tags":["bayesian","dynamic-linear-model","time-series","filtering","forecasting"],"install":[{"cmd":"pip install pydlm","lang":"bash","label":"Default install"}],"dependencies":[],"imports":[{"note":"Common mistake: `import pydlm` does not expose the DLM class; you must import `dlm` explicitly.","wrong":"import pydlm","symbol":"dlm","correct":"from pydlm import dlm"},{"note":"The public API is at top-level; `pydlm.dlm` is a submodule, but direct import works.","wrong":"from pydlm.dlm import dlm","symbol":"dlm","correct":"from pydlm import dlm"}],"quickstart":{"code":"from pydlm import dlm\nimport numpy as np\n\n# Generate sample time series\ndata = [2.0, 2.5, 3.0, 3.5, 4.0]\n\n# Create DLM with polynomial trend of order 1 and seasonal component 4\nmy_dlm = dlm(data) + dlm.trend(1) + dlm.seasonal(4)\n\n# Fit the model\nmy_dlm.fit()\n\n# One-step ahead predictions\npredictions = my_dlm.predictN(N=1)\nprint(predictions)\n\n# Access filtered states\nfiltered_states = my_dlm.getFilteredObs()\nprint(filtered_states)","lang":"python","description":"Basic usage: create a DLM, add components, fit, and forecast."},"warnings":[{"fix":"Convert to list before passing: `data = series.tolist()`.","message":"The library expects 1D list-like data; passing a pandas Series may cause silent errors or shape mismatches.","severity":"gotcha","affected_versions":"all"},{"fix":"Use `dlm.trend(degree=1)` and `dlm.seasonal(period=4)` as static methods.","message":"The `dlm.trend()` and `dlm.seasonal()` functions are part of the 'builder' API. Do not confuse with `trend` and `seasonal` as classes.","severity":"deprecated","affected_versions":"<=0.1.1.13"},{"fix":"Always include `dlm.trend(1)` as a minimum.","message":"Missing component combination: you must add at least one component (trend, seasonal, or dynamic) before fitting; otherwise the model is degenerate.","severity":"gotcha","affected_versions":"all"},{"fix":"Adjust logging level: `import logging; logging.getLogger('pydlm').setLevel(logging.WARNING)`.","message":"In 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.","severity":"breaking","affected_versions":">=0.1.1.13"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Run `pip install --upgrade pydlm` and use `from pydlm import dlm`.","cause":"Outdated package or incorrect import path.","error":"ImportError: cannot import name 'dlm' from 'pydlm'"},{"fix":"Use `from pydlm import dlm`.","cause":"Using `import pydlm` and then `pydlm.dlm`; the class is not exposed at module level.","error":"AttributeError: module 'pydlm' has no attribute 'dlm'"},{"fix":"Pass a simple Python list: `data = list(your_series)`.","cause":"Data is not a list of floats or has unexpected dimension (e.g., 2D array).","error":"ValueError: Can not detect multivariate dimension from the data."}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}