AmazaspShumik / sklearn-bayes

Python package for Bayesian Machine Learning with scikit-learn API
MIT License
513 stars 118 forks source link

'EBLinearRegression' object has no attribute '_center_data' #21

Closed sergeyf closed 7 years ago

sergeyf commented 7 years ago

Hello,

I'm trying to use skbayes with the latest scikit-learn (0.18.x). It looks like self._center_data is no longer being used in sklearn:

from skbayes.linear_models import EBLinearRegression
EB = EBLinearRegression()

EB.fit(X,y)
Traceback (most recent call last):

  File "<ipython-input-30-cd5ea38985d5>", line 1, in <module>
    EB.fit(X,y)

  File "C:\Anaconda2\lib\site-packages\skbayes\linear_models\bayesian_regression.py", line 102, in fit
    X, y, X_mean, y_mean, X_std = self._center_data(X, y, self.fit_intercept,

AttributeError: 'EBLinearRegression' object has no attribute '_center_data'
AmazaspShumik commented 7 years ago

Hmm,

You are right. I will look into this if you have any suggestions you are welcome to contribute.

Thanks.

sergeyf commented 7 years ago

I renamed self._center_data to self._preprocess_data in a bunch of place and it seems to have worked, but I can't test because tester.py seems to be out of date.

AmazaspShumik commented 7 years ago

I just think a lot of people still use old versions of scikit-learn, where there is no _preprocess_data method ( I was one of those people ). I think it will be easier to write simple _center_data method. As for testing, I am working on my test suite , but you can use check_estimator method from scikit-learn for testing any Linear Regression Model in skbayes.

AmazaspShumik commented 7 years ago

Hi, Sergey=)

I added _center_method to linear models issue should be resolved.

sergeyf commented 7 years ago

Thank you very much, that fixed it!