kearnz / autoimpute

Python package for Imputation Methods
MIT License
241 stars 19 forks source link

function( ) got an unexpected keyword argument 'sample' #29

Closed ManojVellatoori closed 4 years ago

ManojVellatoori commented 4 years ago

Hi, I tried SingleImputer on one of my datasets and it is failing, if there are missing values in the column that should be predicted.

And then I tried to run the example given in your tutorial: Link: https://kearnz.github.io/autoimpute-tutorials/ (Getting the Most out of the Imputer Classes: Part III) I tried to run SingleImputer

I'm running into the same error. Auto-assigning NUTS sampler... Initializing NUTS using jitter+adapt_diag... Traceback (most recent call last): File "C:/Users/Desktop/Test/Code/main.py", line 177, in si_data_full = si.fit_transform(data_miss) File "C:\Users\Desktop\Test\venv\lib\site-packages\autoimpute\imputations\dataframe\single_imputer.py", line 275, in fit_transform return self.fit(X, y).transform(X) File "C:\Users\Desktop\Test\venv\lib\site-packages\autoimpute\utils\checks.py", line 61, in wrapper return func(d, *args, kwargs) File "C:\Users\Desktop\Test\venv\lib\site-packages\autoimpute\utils\checks.py", line 126, in wrapper return func(d, *args, *kwargs) File "C:\Users\Desktop\Test\venv\lib\site-packages\autoimpute\utils\checks.py", line 173, in wrapper return func(d, args, kwargs) File "C:\Users\Desktop\Test\venv\lib\site-packages\autoimpute\imputations\dataframe\single_imputer.py", line 261, in transform X.loc[impix, column] = imputer.impute(x) File "C:\Users\Desktop\Test\venv\lib\site-packages\autoimpute\imputations\series\default.py", line 400, in impute X = super().impute(X) File "C:\Users\Desktop\Test\venv\lib\site-packages\autoimpute\imputations\series\default.py", line 214, in impute X = imp.impute(X) File "C:\Users\Desktop\Test\venv\lib\site-packages\autoimpute\imputations\series\pmm.py", line 155, in impute init=self.init, File "C:\Users\Desktop\Test\venv\lib\site-packages\pymc3\sampling.py", line 396, in sample progressbar=progressbar, kwargs) File "C:\Users\Desktop\Test\venv\lib\site-packages\pymc3\sampling.py", line 1515, in init_nuts step = pm.NUTS(potential=potential, model=model, kwargs) File "C:\Users\Desktop\Test\venv\lib\site-packages\pymc3\step_methods\hmc\nuts.py", line 152, in init super().init(vars, kwargs) File "C:\Users\Desktop\Test\venv\lib\site-packages\pymc3\step_methods\hmc\base_hmc.py", line 72, in init super().init(vars, blocked=blocked, model=model, dtype=dtype, theano_kwargs) File "C:\Users\Desktop\Test\venv\lib\site-packages\pymc3\step_methods\arraystep.py", line 228, in init vars, dtype=dtype, theano_kwargs) File "C:\Users\Desktop\Test\venv\lib\site-packages\pymc3\model.py", line 723, in logp_dlogp_function return ValueGradFunction(self.logpt, grad_vars, extra_vars, kwargs) File "C:\Users\Desktop\Test\venv\lib\site-packages\pymc3\model.py", line 462, in init inputs, [self._cost_joined, grad], givens=givens, **kwargs) TypeError: function() got an unexpected keyword argument 'sample'

Note: I don't have C++ installed. My warning list is: WARNING (theano.configdefaults): g++ not available, if using conda: conda install m2w64-toolchain C:\Users\Desktop\Test\venv\lib\site-packages\theano\configdefaults.py:560: UserWarning: DeprecationWarning: there is no c++ compiler.This is deprecated and with Theano 0.11 a c++ compiler will be mandatory warnings.warn("DeprecationWarning: there is no c++ compiler." WARNING (theano.configdefaults): g++ not detected ! Theano will be unable to execute optimized C-implementations (for both CPU and GPU) and will default to Python implementations. Performance will be severely degraded. To remove this warning, set Theano flags cxx to an empty string. WARNING (theano.tensor.blas): Using NumPy C-API based implementation for BLAS functions.

marcelkore commented 4 years ago

getting the same error as above.

TypeError: function() got an unexpected keyword argument 'sample'

kearnz commented 4 years ago

Hi @ManojVellatoori @marcelkore

This problem has been addressed in a previously closed issue and is also discussed in the README.

Bayesian-based methods in Autoimpute work with pymc3==3.5 and pymc3==3.6. The latest release of pymc3 is 3.7, which breaks Autoimpute. I'm currently working on a fix to get Autoimpute back in line with the latest pymc3, but I do not have an ETA.

Your best option is to install Autoimpute using the requirements.txt file. Also best to do this in a virtual environment.

Please let me know if this fixes the issue.

Joe

kearnz commented 4 years ago

closing as issue has already been solved and no more activity from OPs