Closed BrianMiner closed 5 years ago
mu = a + bA * normalize(adstock(pd_sales.advert.values,ad_rate))
You're passing a Theano variable, ad_rate
, to Numpy; what you need to do is pass the Numpy/numeric value of ad_rate
to the Numpy operations.
Theano has an as_op
you can use for that.
ALso these questsions should go to the discourse.
@brandonwillard thanks. I moved this to discourse: https://discourse.pymc.io/t/optimizing-a-parameter-for-an-outside-function/2629 Still have an error. I am hoping this doesn't require theano knowledge :(
I am trying to fit a simple linear regression as proof of concept for a larger problem, whereby I am transforming the X variable according to the ad stock transformation.
My question is how to optimize a parameter that is passed to an external function during fitting and is there any way then to have that found optimal value be taken into consideration (i.e. used) when you predict new data using sample_posterior_predictive()?
Here is a self-contained program and a note about what seems to work and when this fails.
from statsmodels.tsa.filters.filtertools import recursive_filter import pymc3 as pm import numpy as np import pandas as pd
normalize to range 0-100
HERE THIS WORKS WHEN HARD-CODING THE PARAMETER
HERE THIS FAILS
TypeError Traceback (most recent call last)