How to Solve NameError: name 'r2_score' is not defined -- sklearn

Solution: Import the 'r2_score' module

To Solve the error, add the following line to the top of your code.

from sklearn.metrics import r2_score

 

For more information:
Python sklearn r2_score