statsmodels LinearRegression bug

statsmodels LinearRegression bug

I realise whenever i run linearRegression with intel python distrbution i get the following error

  File "/home/dc/intel/intelpython3/lib/python3.5/site-packages/sklearn/daal4sklearn/linear.py", line 146, in predict
    good_shape_for_daal = True if X.ndim == 1 else True if X.shape[0] > X.shape[1] else False

IndexError: tuple index out of range

 

i can simulate this error with the following code

from sklearn.linear_model import LinearRegression

y=[2,5,10,20,30,60]
x=np.arange(1,7)
model.fit(x[:,np.newaxis],y)
y_predict=model.predict(5)

this would work in any other python distribution withh normal sklearn

 

2 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

Hi, 

Thank you for bringing the issue to our attention. We have reproduced the problem. As a work-around you could either use

model.predict([[5]])

or disable optimizations by doing 

from sklearn.daal4sklearn import dispatcher
dispatcher.disable()

The fix will incorporated in the next update of the package.

Leave a Comment

Please sign in to add a comment. Not a member? Join today