Intel® Distribution for Python*
Engage in discussions with community peers related to Python* applications and core computational packages.

statsmodels LinearRegression bug

des_c_
Beginner
519 Views

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

 

0 Kudos
1 Reply
Oleksandr_P_Intel
519 Views

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.

0 Kudos
Reply