question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Adding BSTS (Bayesian structural time series models) model via tensorflow_probability

See original GitHub issue

Is your feature request related to a problem? Please describe. I and @koralturkk would like to add a wrapper for forecasting with BSTS Examples are given here.

Describe the solution you’d like

Idea 1) Wrapping each possible module via an argument of type list containing one or several dict. For example:

tfp.sts.DynamicLinearRegression(
    design_matrix, drift_scale_prior=None, initial_weights_prior=None,
    observed_time_series=None, name=None
)

…would become

add_DynamicLinearRegression = [{
"design_matrix" = design_matrix,
"drift_scale_prior"=None, "initial_weights_prior"=None,
    "observed_time_series"=None, "name"=None}]

So this is also the way I was wrapping in fbprophet with add_seasonality() e.g.

Idea 2) Allowing that the user creates the modules outside sktime so that it can be passed as a tfp.sts class:

import tensorflow_probability as tfp
dlr = tfp.sts.DynamicLinearRegression(
    design_matrix, drift_scale_prior=None, initial_weights_prior=None,
    observed_time_series=None, name=None
)

We would need **kwargs for it to pass dlr in sktime.BSTS(dlr)

Looking forward for your feedback @mloning

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:10

github_iconTop GitHub Comments

3reactions
fkiralycommented, Jan 13, 2021

Hm, regarding design: I think aiming for both wrapped individual components and wrapped composites makes sense here! If I had to choose, I’d say to aim for wrapped composites, since that is more flexible and robust with regards to extensions and changes of BSTS.

The “really nice thing”, design-wise, would be adding a compiler-like layer that recognizes when adjacent sktime components are from BSTS and replaces them by a wrapped (and more efficient) BSTS composite. But perhaps out of scope due to complexity…

Regarding dependencies: as @mloning says, one of these days, we need to fix how we manage the neural network package dependencies. Currently, we have no maintainer dedicated to that family of dependencies - it is quite some work to keep these spinning, so help would be very much welcome. The problem is greater than just BSTS, it is essentially “anything that depends on tf”, so it would be maintaining “time series models using deep learning packages”.

2reactions
mloningcommented, Jan 13, 2021

Ok, we can give it a try to integrate it into sktime!

But we may have to make a difficult decision to not include it in the end, if we need to touch too much of the CI/CD pipeline, and move it to a separate repo. I worry about the extra maintenance burden for the CI/CD pipelines when upgrading versions later on. We have had similar issues with other packages already (e.g. the ongoing work to integrate the signature-based module).

Read more comments on GitHub >

github_iconTop Results From Across the Web

Structural Time Series modeling in TensorFlow Probability
This support includes Bayesian inference of model parameters using variational inference (VI) and Hamiltonian Monte Carlo (HMC), computing both ...
Read more >
Adding BSTS (Bayesian structural time series models ... - GitHub
I'm a little hesitant on adding TensorFlow Probability as a soft dependency because we had several issues with integrating it into the CI/CD ......
Read more >
Structural Time-Series Forecasting with TensorFlow Probability
In this article, we have seen how we can develop a Bayesian Structural Time Series model using TensorFlow Probability's Structural Time Series ......
Read more >
Exploring TensorFlow Probability STS Forecasting
In this notebook we explore the Structural Time Series (STS) Module of TensorFlow Probability. We follow closely the use cases presented in ...
Read more >
Structural time-series modelling with TensorFlow Probability
Tensorflow probability is an based on Bayesian Neural Networks which helps to study and forecast structural time series data.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found