Closed ragAgar closed 3 years ago
Hi @ragAgar, will look into this in the next few days and let you know.
Hi @ragAgar, apologies it took so long to get back to you.
You've found a bug in how the MiceImputer
implements bayesian methods. Note that both bayesian binary
and bayesian least squares
suffer from this issue. Essentially, pymc3
, the underlying package we leverage for building bayesian models, does not allow you to redefine an existing deterministic variable. autoimpute
tries to do that when it iterates through imputations. I will work on a fix for this bug this weekend when I'm tackling another issue.
If you're interested, here's where that pops up in autoimpute
. Both the MultipleImputer
and the MiceImputer
create n
SingleImputer
instances under the hood (in your example, n=2
). In the MultipleImputer
, each of those n_i
instances iterates k=1
time. So if you use a bayesian method, the bayesian model variables are created 1 time for each n
instances. Perfectly valid. But for the MiceImputer
, each n_1
instances of the SingleImputer
iterate k=5
(by default) times. So each instance tries to recreate bayesian variables k
times, and that throws an error.
I'll keep you updated when release is ready. For now I'd recommend just using default strategies.
Closing this issue and creating a separate bug report.
Hi,
Thank you for sharing a very useful and flexible implementation ! It's interesting because I've been wanting to do Multiple Imputation in Python.
I have two questions about applying
MICEImputer
to new data.Now I want to do mice like mice package in R, but I also want to apply mice to new data as frequent situations in machine learning. I tried the following code to apply
MICEImputer
to new data, but I got anValueError: Variable name p_pred already exists.
. When I usedbinary logistic
andleast square
instead of bayesian methods, there were no errors.First,
binary logistic
andleast square
the same aslogreg
andnorm
inmice
? Second, can beyesian methods strategy be applied to new data?Thank you for reading my long request and sorry for poor English.