I am encountering a TypeError: ‘numpy.float64’ object is not callable when I try to calculate the r2_score using scikit-learn’s r2_score function. Below is the relevant portion of my code:
from sklearn.metrics import r2_score, mean_squared_error
# Assuming Y is the actual values and ypipe is the predicted values
print('MSE for multi-variable polynomial pipeline is: ', mean_squared_error(Y, ypipe))
print('R^2 for multi-variable polynomial pipeline is: ', r2_score(Y, ypipe))
However, I receive the following error:
TypeError: 'numpy.float64' object is not callable
enter image description here
This is also appearing when calculating r2_score for polynomial regression
enter image description here
New contributor
Ayush Surve is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.