The r2_score function in scikit-learn measures the coefficient of determination (R-squared) when applied to a regression model. R-squared is a statistical measure that represents the proportion of the variance in the dependent variable that is predictable from the independent variables. It provides an indication of how well the observed outcomes are replicated by the model.
Here's an example of how to use the r2_score function in Python:
main.py187 chars6 lines
In the output, the value of r2
will represent the R-squared value, with 1.0 being the best possible score indicating a perfect fit.
gistlibby LogSnag