tensorflow / tensorflow/probability

Error when using tfp.sts.Sum with StateSpace Components

Open
#1,603 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Jupyter Notebook
Stars
4.4k
Forks
1.1k
PR merge metrics
No merged PRs in 30d

Description

Running this simple Example:

from tensorflow_probability import sts
local_ssm = sts.LocalLinearTrendStateSpaceModel(name='local',num_timesteps=30,level_scale=0.5,slope_scale=0.1,
                                                    initial_state_prior=tfd.MultivariateNormalDiag(loc=[0., 0.], scale_diag=[1., 1.]))
model = sts.Sum([local_ssm])

Gives the error ( in tfp version 0.17.0):

File "/usr/local/lib/python3.8/dist-packages/tensorflow_probability/python/sts/components/sum.py", line 462, in init
name='{}_{}'.format(component.name, parameter.name),
AttributeError: 'str' object has no attribute 'name'

Note:

The variable "parameter" in SS components are Python str. So this loop in /tensorflow_probability/python/sts/components/sum.py fails:

  for component in components:
    for parameter in component.parameters:
      parameters.append(Parameter(
          name='{}_{}'.format(component.name, parameter.name),  # FAILS  because 'parameter' is str for StateSpace components
          prior=parameter.prior, bijector=parameter.bijector))

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with tensorflow_probability/python/sts/components/sum.py, especially the loop around line 462, and reproduce the reported example using sts.Sum with a LocalLinearTrendStateSpaceModel. Trace the StateSpace component parameters and verify that the example constructs the summed model without the reported AttributeError.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, tensorflow
Domain
machine-learning
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.