Skip to content

BUG: AttributeError: '_FutureWarningValidatingScratchpad' object has no attribute 'test_value' #6452

Open
@RichardScottOZ

Description

@RichardScottOZ

Describe the issue:

New to trying out pymc3

trying this:

Reproduceable code example:

import pymc as pm
with pm.Model() as model:
    # Define the model variables
    alpha = pm.Normal('alpha', 0, 1)
    beta = pm.Normal('beta', 0, 1)
    sigma = pm.Normal('sigma', 0, 20)
    # Define the model equation
    y_pred = np.zeros(len(returns))
    y_pred[0] = returns[0]
    for i in range(1, len(returns)):
        y_pred[i] = sigma.tag.test_value * (1-alpha.tag.test_value-beta.tag.test_value) + alpha.tag.test_value * returns[i-1]**2 + beta.tag.test_value * y_pred[i-1]
    garch_eq = pm.Deterministic('garch_eq', y_pred)
    # Specify the likelihood function
    likelihood = pm.Normal('y', mu=garch_eq, tau=1.0/sigma.tag.test_value**2, observed=returns)
    # Run the model
    mcmc = pm.MCMC(model)
    mcmc.sample(iter=50000, burn=20000)

Error message:

Traceback (most recent call last)
Cell In[127], line 10
      8 y_pred[0] = returns[0]
      9 for i in range(1, len(returns)):
---> 10     y_pred[i] = sigma.tag.test_value * (1-alpha.tag.test_value-beta.tag.test_value) + alpha.tag.test_value * returns[i-1]**2 + beta.tag.test_value * y_pred[i-1]
     11 garch_eq = pm.Deterministic('garch_eq', y_pred)
     12 # Specify the likelihood function

File ~\AppData\Local\Continuum\anaconda3\envs\copper\lib\site-packages\pymc\util.py:505, in _FutureWarningValidatingScratchpad.__getattribute__(self, name)
    500         else:
    501             warnings.warn(
    502                 f"The tag attribute {name} is deprecated. Use {alternative} instead",
    503                 FutureWarning,
    504             )
--> 505 return super().__getattribute__(name)

File ~\AppData\Local\Continuum\anaconda3\envs\copper\lib\site-packages\pytensor\graph\utils.py:284, in Scratchpad.__getattribute__(self, name)
    283 def __getattribute__(self, name):
--> 284     return super().__getattribute__(name)

PyMC version information:

pymc 5.0.1 hd8ed1ab_0 conda-forge
pymc-base 5.0.1 pyhd8ed1ab_0 conda-forge
pytensor 2.8.11 py38hd636df3_1 conda-forge
pytensor-base 2.8.11 py38haa244fe_1 conda-forge
python 3.8.15 h4de0772_0_cpython conda-forge

Windows 10
Conda

Context for the issue:

just a test: test_vallue seems to get exist

image

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions