Closed FabricatiDiem closed 1 year ago
@FabricatiDiem thanks for opening the issue!
This is indeed a bug. The problem is not about using multiple functions. The problem is some internal machinery is not being able to compare two values, and that's because of the '2' and the '3' in the function calls.
If you generate custom functions and use them, only with variable names, it works
test_data_df = pd.DataFrame.from_dict({
'X': [-1, -0.97979798, -0.95959596, -0.93939394, -0.91919192],
'y': [-6.2, -5.93976743, -5.68822415, -5.44516237, -5.21037433],
})
def p2(x):
return np.power(x, 2)
def p3(x):
return np.power(x, 3)
bmb.Model("y ~ X + p2(X) + p3(X)", test_data_df)
Formula: y ~ X + p2(X) + p3(X)
Family: gaussian
Link: mu = identity
Observations: 5
Priors:
target = mu
Common-level effects
Intercept ~ Normal(mu: -5.6967, sigma: 34.3017)
X ~ Normal(mu: 0.0, sigma: 30.6203)
p2(X) ~ Normal(mu: 0.0, sigma: 15.9535)
p3(X) ~ Normal(mu: 0.0, sigma: 11.0754)
Auxiliary parameters
y_sigma ~ HalfStudentT(nu: 4.0, sigma: 0.3499)
So this is just a workaround to make it work now. I'll try to fix the bug.
Thank you!
@FabricatiDiem it's fixed if you install from the master branch now :)
I'm trying out a basic polynomial regression with Bambi, but I keep hitting the following error in Formulae when specifying multiple higher-order terms:
Here is a minimal example to reproduce:
Using: Python 3.10 PyMC 5.02 Bambi 0.9.3 Formulae 0.3.4
It seems like something like this used to work before, so I'm curious what I am doing wrong.