Skip to content

BUG: Combination covariance errors with WhiteNoise #6673

@dehorsley

Description

@dehorsley

Describe the issue:

Post v5.2.0, gp.cov.Combination covariance has extra checks (at cov.py:189) that fail with a WhiteNoise covariance.

Currently, the check for input_dim equality fails there is also a lurking problem with calculating active_dims.

Reproduceable code example:

import pm
pm.gp.cov.Exponential(2, ls=1) + pm.gp.cov.WhiteNoise(sigma=1)

Error message:

AttributeError                            Traceback (most recent call last)

<ipython-input-1-7257c4d70473> in <cell line: 3>()
      1 import pymc as pm
      2 print(pm.__version__)
----> 3 pm.gp.cov.Exponential(2, ls=1) + pm.gp.cov.WhiteNoise(sigma=1)

2 frames

/usr/local/lib/python3.9/dist-packages/pymc/gp/cov.py in __add__(self, other)
     83         if isinstance(other, numbers.Real):
     84             other = Constant(c=other)
---> 85         return Add([self, other])
     86 
     87     def __mul__(self, other):

/usr/local/lib/python3.9/dist-packages/pymc/gp/cov.py in __init__(self, factor_list)
    187 
    188         # Check if all input_dim are the same in factor_list
--> 189         input_dims = {factor.input_dim for factor in factor_list if isinstance(factor, Covariance)}
    190 
    191         if len(input_dims) != 1:

/usr/local/lib/python3.9/dist-packages/pymc/gp/cov.py in <setcomp>(.0)
    187 
    188         # Check if all input_dim are the same in factor_list
--> 189         input_dims = {factor.input_dim for factor in factor_list if isinstance(factor, Covariance)}
    190 
    191         if len(input_dims) != 1:

AttributeError: 'WhiteNoise' object has no attribute 'input_dim'

PyMC version information:

pymc==5.2.0

installed via pip

OS: *

Context for the issue:

Affects any use of latent GPs with noise.

Metadata

Metadata

Assignees

No one assigned

    Labels

    GPGaussian Processbug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions