I have implemented ann for regression using tensorflow keras on a dataframe. I am trying to calculate different accuracy metrics for the predictions. Following is the part of the code I have used for calculating the accuracy metrics.
ypred = model_sel.predict(xscale_val)
ypred1 = scaler_y.inverse_transform(ypred)
print("x")
plt.plot(yact.values)
plt.plot(ypred1.tolist( ))
# plt.show()
ANN_RMSE = sqrt(mean_squared_error(yact.values,ypred1.tolist()))
ANN_R2 = r2_score(yact.values,ypred1.tolist())
ANN_MAE = mean_absolute_error(yact.values,ypred1.tolist())
print("type",type(yact),type(yact.values),type(ypred1),type(ypred1.tolist()))
print(yact.values)
print("pred",ypred1.tolist())
ANN_R = stats.pearsonr(yact.values,ypred1)
I am not able to get the pearson correlation value for the predictions. I am beginner in python, it would help me if you can provide information on what I am doing wrong and how to correct this.
following is the error, Iam seeing.
File "c:\Users\DELL\journalPub\models.py", line 166, in ann_model_results
ANN_R = stats.pearsonr(yact.values,ypred1)
File "C:\Users\DELL\AppData\Local\Programs\Python\Python39\lib\site-packages\scipy\stats\stats.py", line 4034, in pearsonr
xmean = x.mean(dtype=dtype)
File "C:\Users\DELL\AppData\Local\Programs\Python\Python39\lib\site-packages\numpy\core\_methods.py", line 160, in _mean
ret = umr_sum(arr, axis, dtype, out, keepdims)
TypeError: No loop matching the specified signature and casting was found for ufunc add