1

I'm working to migrate my code from pymc3 to pymc5 but I have found some problem to adapt out of sample prediction

I have the code below:

features [f1,f2]
target = df[target].values
basic_model =pm.Model()

with basic_model:
    response_mean = []
    
    for f in features 
        ff= df[f].values
        beta = pm.HalfNormal(f'coeff_{f}', sigma = 2)
        decay = pm.Beta(f'decay_{f}', alpha=3, beta=3)
        contribution = pm.Deterministic(f'contribution_{f}', (ff*decay*beta)
        response_mean.append(contribution)
                    
    sigma = pm.HalfNormal('sigma', sigma=1)
    
    likelihood =  pm.Normal("likelihood", mu=sum(response_mean), sigma=sigma, observed=target)   

with basic_model:
    idata = pm.sample(return_inferencedata=True, tune= 1000)

Now I would like to run out-of-sample prediction starting from new values of f1 and f2 Looking at documentation [https://www.pymc.io/projects/examples/en/latest/generalized_linear_models/GLM-out-of-sample-predictions.html][1] I have to use data containers (pm.MutableData) but I am not able to integrate those containers in my code. Is there anyone who can give me a suggestion?

cervus_pc
  • 25
  • 3

0 Answers0