I'm wondering how to train a Multivariate Bayesian Structural Time Series (BSTS) model that automatically performs feature selection on hundreds of input time series using Tensorflow Probability.
The TF-Probability BSTS blog post shows how to include seasonal effects alongside a single input feature:
...
temp_effect = sts.LinearRegression(
design_matrix=tf.reshape(temp - np.mean(temp),
(-1, 1)), name='temp_effect')
...
model = sts.Sum([..., temp_effect,...],
observed_time_series=observed_time_series)
But what about when there are multiple input time series?
Reading through the documentation makes it seem that with many inputs the SparseLinearRegression would be preferrable, which makes sense, but how should I adapt my code?
The documentation for both LinearRegression and SparseLinearRegression method suggests using design_matrix=tf.stack([series1, series2], axis=-1), weights_prior_scale=0.1)
, but since that's different from how TF-Probability's own blog post uses it I am unsure if that is the best way to go.
Should I be adding all (several hundred) input features inside the design_matrix
of a single SparseLinearRegression, or should I be adding a separate LinearRegression for each feature and then use sts.Sum()
to combine them all into the model? Though I would like the functionality of visualizing the impact of each feature, I am most interested in having the model automatically perform feature selection and generate weights for the remaining features which I can have access to.