Roadmap¶
pyLGM 0.6 is a bounded, correct-by-construction foundation. This page is the honest map of what's shipped, what's next, and what's deliberately deferred. For the precise semantics of each shipped feature, follow the links into the guide.
Shipped in 0.6¶
- Likelihoods — Gaussian (exact engine), Poisson, Bernoulli, Binomial
(counts
n·pwith a per-row trials column), NegativeBinomial (overdispersed counts), Gamma (positive-continuous), and Beta (proportions in(0,1)), all on the Laplace engine, with fixed or estimated dispersionφ. See likelihoods. - Effects —
Fixed,IID,RW1/RW2, stationaryAR1(optionally replicated: one independent series per panel unit, sharingρandprecision), the driftingSeasonalpattern, theMIDASmixed-frequency smooth-lag effect and its restricted (parametric)MIDASParametriccounterpart (exp-Almon / Beta lag kernels), and the Knorr-HeldSpaceTimeinteraction (Types I–IV). See effects. -
Effect modifiers — R-INLA expresses
weights,copy,replicateandgroupas arguments of onef()call; pyLGM ships them as composable wrappers, so any indexed effect gains them without each effect reimplementing four validation paths.Weighted(effect, by)scales the design by a column (spatially-varying coefficients);Copy(name, index, scale)lets one latent field enter a predictor twice at different indices, optionally under an estimated scale;Replicated(effect, over)givesRindependent copies sharing every hyperparameter (I_R ⊗ Q); andGrouped(effect, over, structure)givesGcorrelated copies tied by a between-group precision (Q_S ⊗ Q_E), withIIDStructure,AR1Structure,RW1Structure/RW2StructureandBesagStructureavailable forQ_S. The three that map onto Knorr-Held's interaction types reproduceSpaceTimeI–IV, which is how the composition is checked. Each modifier still produces exactly one latent block, so inference is untouched. See effects, and research status for what is and is not verified. -
Hybrid composition — a mixed-frequency
MIDASterm, a spatialBYM2term, and a temporalAR1term sum through+into one latent field that fits and predicts, demonstrated end to end inexamples/hybrid_nowcast. - Spatial (CAR) family —
Besag(ICAR),ProperCAR(withρfixed or estimated), andBYM2(withφfixed or estimated), complete for the dense reference regime. Graphs may be weighted ({node: {neighbour: weight}}), so the same family models firm-ownership / interbank-exposure / supply-chain networks, not only geographic adjacency. Isolated regions (no neighbours) are handled gracefully as independentIIDsingletons inBesag/BYM2(dense and augmented paths), and the augmented large-graphBYM2supports multi-component (island) graphs. See spatial effects. - Hyperparameter estimation — type-II ML empirical Bayes and MAP-II with PC/Gaussian priors, with bounded hyperparameters. See empirical Bayes.
- Posterior integration — INLA-style grid quadrature with gaussian, simplified-Laplace, and full-Laplace latent marginals, plus DIC/WAIC/CPO/PIT model-assessment criteria. See INLA integration.
- Prediction — fit-row and out-of-sample
result.predict(new_data). See prediction. - Data boundary — Pandas, or Spark / Databricks input. See Spark.
- Declarative frontend — models expressible in YAML via
pylgm.config.load_model, including the temporalar1(optionally group-wise) andseasonaleffects, the spatialbesag/proper_car/bym2families with an inline or file graph (graph_fileaccepts an R-INLA.graphor a.jsonneighbour dict), the Knorr-Heldspacetimeinteraction (types I–IV, indexed by aspace+timepair), the directedsarand its time-varyingdynamicspatialpanel(SDPD, indexed by aunit+timepair with per-period inlinegraphsor agraph_filesmapping), and the mixed-frequencymidas(smooth-lag) andmidas_parametric(exp-Almon / Beta kernel) effects, indexed by their HF lagcolumns. Every effect is now reachable from YAML — no Python-only effects remain. See spatial effects and effects. - Sparse large-graph scaling (E-sparse) — network and space-time models
whose latent dimension exceeds the dense reference regime now fit past the
dense guard through a sparse constrained-Gaussian solver, delivering posterior
mean, marginal likelihood, estimated hyperparameters, and point predictions
(A+B), and the full posterior-uncertainty surface at network scale (C):
selected-inverse marginal, predictive, and linear-combination variances with
constrained corrections,
predict, sparse Sørbye-Rue scaling, augmented BYM2, and diagonal INLA grid integration — no new dependency, deterministic. The augmented BYM2 also exposes its structured componentu*as a separately reported latent:latent_marginals("region")returns thex-marginals andlatent_marginals("region.structured")theu*marginals. See spatial effects. - Survival likelihoods —
WeibullSurv(Weibull proportional hazards, shapealphafixed or estimated) andExponentialSurv(alpha = 1), with right-censoring (event) and left-truncation (entry) support,alphaestimation by empirical Bayes, and unobserved heterogeneity via an ordinaryIIDfrailty term over individuals. See likelihoods and the runnable unemployment-duration example. - Directed & dynamic network structure — a directed
SAReffect ((I−ρW)ᵀ(I−ρW)on a row-standardized, generally-asymmetricW) for economic influence relations that symmetric CAR discards, and its time-varying generalizationDynamicSpatialPanel(contemporaneousρ, temporalγ, spatio-temporal-diffusionηover a balancedunit x timegrid,T=1reducing exactly toSAR). Both fit past the dense guard through the E-sparse solver, support forward forecasting (forecast_dynamic_spatial_panel) for future periods' networks, and both are declarable from YAML (type: sar/type: dynamicspatialpanel). See spatial effects andexamples/directed_network_sar. - Diagnostics — an empirical-Bayes estimate that lands on the edge of its
declared interval is now reported in
result.diagnostics["hyperparameters_at_bound"]and warned about, because a pinned estimate means the bound (often a default derived frominitial) rather than the data is setting the value.
Joint models are research-grade and live on the
research-tierbranch, notmain. They are tested and reviewed, but validated only internally and against MCMC on simulated data -- no published result on real data has been reproduced, andlatent_strategy="laplace"is known to degrade on them. See research status for exactly what is and is not established.
- Joint multi-likelihood models —
Jointstacks severalLGMsub-models (each with its own response, likelihood, offset, and predictor) into one fit, withSharedletting one latent field enter more than one sub-model under a per-sub-model scaling, including the Knorr-Held & Best(delta, delta⁻¹)shared-component pairing for exactly two sub-models. Fits byengine="laplace"only; per-outcome prediction viaresult.predict(new_data, outcome=...). This covers the scaling half of R-INLA'scopy— a shared field entering another sub-model under an estimated multiplicative scale — but the copied field's own hyperparameters (precision, rho, phi, ...) must stay fixed, unlikecopy, which estimates those too. It also does not cover off-block-diagonal precision coupling (coregionalization) — see joint models.copyandreplicatewithin a single sub-model shipped separately, as theCopyandReplicatedmodifiers above.
Breaking changes in 0.6¶
forecast_dynamic_spatial_panelreturnslatent_mean/latent_varianceinstead ofmean/variance. The values are unchanged; the old names read as a response-scale forecast, but they exclude the fixed effects, so comparing them with observations was wrong by the response's mean level. See spatial effects.
Next¶
Ordered roughly by expected value to users. Nothing here is committed to a date.
- Matérn / SPDE spatial fields as an alternative to CAR neighbour graphs.
- Hybrid HF/LF nowcasting frontend — a higher-level mixed-frequency
nowcasting API that handles the HF→LF lag alignment (still the caller's job
today). The underlying effects ship both in the Python API and as the
declarative
midas/midas_parametricYAML types.
Deferred (not planned for the near term)¶
- Parameterized IR metadata and sparse production engines.
- Full MCMC/HMC inference — pyLGM is deterministic-approximation-first by design.
How to influence this¶
Open an issue at github.com/Ardea00/pylgm/issues describing the model you're trying to fit. Real use cases reorder this list.