Closed davidetedd92 closed 2 years ago
apologies for the delayed response. I've rewritten some of the code to work with the new version of pymc
. In doing so I'm unable to reproduce your error. Feel free to open another pull issue if the problem persists, and I'll be on it.
mi_pmm = MultipleImputer( n=5, strategy={'age':'pmm', 'sex':'binary logistic'}, predictors={'age':'all', 'sex':"all"}, imp_kwgs={'pmm':{'fill_value':'random', 'neighbors':5}}, return_list = True )
perform PMM imputation procedure
imp_pmm = mi_pmm.fit(dataset)
this code produce this error.
ypeError Traceback (most recent call last) ~/opt/anaconda3/envs/everli/lib/python3.7/site-packages/autoimpute/imputations/dataframe/single_imputer.py in fit(self, X, y, imp_ixs) 167 if imp_params is None: --> 168 imputer = imp() 169 else:
~/opt/anaconda3/envs/everli/lib/python3.7/site-packages/autoimpute/imputations/series/pmm.py in init(self, **kwargs) 98 self.copy_x, ---> 99 self.n_jobs 100 )
TypeError: init() takes 1 positional argument but 5 were given
The above exception was the direct cause of the following exception:
ValueError Traceback (most recent call last) /var/folders/_j/kf8xl_kn66ncy8kqw8yxw2r00000gp/T/ipykernel_25481/2682908908.py in
9
10 # perform PMM imputation procedure
---> 11 imp_pmm = mi_pmm.fit(dataset.fillna(0))
~/opt/anaconda3/envs/everli/lib/python3.7/site-packages/autoimpute/utils/checks.py in wrapper(d, *args, *kwargs) 59 err = f"Neither {d_err} nor {a_err} are of type pd.DataFrame" 60 raise TypeError(err) ---> 61 return func(d, args, **kwargs) 62 return wrapper 63
~/opt/anaconda3/envs/everli/lib/python3.7/site-packages/autoimpute/utils/checks.py in wrapper(d, *args, *kwargs) 124 125 # return func if no missingness violations detected, then return wrap --> 126 return func(d, args, **kwargs) 127 return wrapper 128
~/opt/anaconda3/envs/everli/lib/python3.7/site-packages/autoimpute/utils/checks.py in wrapper(d, *args, *kwargs) 171 err = f"All values missing in column(s) {nc}. Should be removed." 172 raise ValueError(err) --> 173 return func(d, args, **kwargs) 174 return wrapper 175
~/opt/anaconda3/envs/everli/lib/python3.7/site-packages/autoimpute/imputations/dataframe/multipleimputer.py in fit(self, X, y) 196 visit=self.visit 197 ) --> 198 imputer.fit(X) 199 self.statistics[i] = imputer 200
~/opt/anaconda3/envs/everli/lib/python3.7/site-packages/autoimpute/utils/checks.py in wrapper(d, *args, *kwargs) 59 err = f"Neither {d_err} nor {a_err} are of type pd.DataFrame" 60 raise TypeError(err) ---> 61 return func(d, args, **kwargs) 62 return wrapper 63
~/opt/anaconda3/envs/everli/lib/python3.7/site-packages/autoimpute/utils/checks.py in wrapper(d, *args, *kwargs) 124 125 # return func if no missingness violations detected, then return wrap --> 126 return func(d, args, **kwargs) 127 return wrapper 128
~/opt/anaconda3/envs/everli/lib/python3.7/site-packages/autoimpute/utils/checks.py in wrapper(d, *args, *kwargs) 171 err = f"All values missing in column(s) {nc}. Should be removed." 172 raise ValueError(err) --> 173 return func(d, args, **kwargs) 174 return wrapper 175
~/opt/anaconda3/envs/everli/lib/python3.7/site-packages/autoimpute/imputations/dataframe/single_imputer.py in fit(self, X, y, imp_ixs) 172 name = imp.name 173 err = f"Invalid arguments passed to {name} init method." --> 174 raise ValueError(err) from te 175 176 # identify the column for imputation
ValueError: Invalid arguments passed to PMMImputer init method.
MacOSX 12.1 Monteray python 3.7.3 last version of autoimputer