"TypeError: No loop matching the specified signature and casting was found for ufunc add" when calling pearsonr from scipy.stats.stats

Viewed 598

I'm running this Code:

from scipy.stats.stats import pearsonr
y_test = y_test.astype(float)
y_predicted = y_predicted.astype(float)
print (pearsonr(y_test, y_predicted))
y_train_predict =  model.predict(X_train)
print (pearsonr(y_train, y_train_predict))

when y_predicted is coming out of keras model like y_train_predict, and y_test and y_train are just arrays.

I get the following error:

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-29-3cdf50a9131b> in <module>()
      2 y_test = y_test.astype(float)
      3 y_predicted = y_predicted.astype(float)
----> 4 print (pearsonr(y_test, y_predicted))
      5 y_train_predict =  model.predict(X_train)
      6 print (pearsonr(y_train, y_train_predict))

~/.conda/envs/kerasenv/lib/python3.6/site-packages/scipy/stats/stats.py in pearsonr(x, y)
   3411         r_{pb} = \frac{\overline{Y_{1}} -
   3412                  \overline{Y_{0}}}{s_{y}}\sqrt{\frac{N_{1} N_{2}}{N (N - 1))}}
-> 3413 
   3414     Where :math:`Y_{0}` and :math:`Y_{1}` are means of the metric
   3415     observations coded 0 and 1 respectively; :math:`N_{0}` and :math:`N_{1}`

~/.conda/envs/kerasenv/lib/python3.6/site-packages/numpy/core/_methods.py in _mean(a, axis, dtype, out, keepdims)
    149     return ret
    150 
--> 151 def _ptp(a, axis=None, out=None, keepdims=False):
    152     return um.subtract(
    153         umr_maximum(a, axis, None, out, keepdims),

TypeError: No loop matching the specified signature and casting was found for ufunc add

The interesting thing that this problem happens only when I run the code on INTEL@Devcloud server. When I run this on python of my laptop is running fine.

0 Answers
Related