r2 score code example Example: r2 score R^2 (coefficient of determination) regression score function.