# The co-efficient of determination or r-squared

<https://www.safaribooksonline.com/library/view/machine-learning-with/9781785889936/53453938-8345-4d5f-8425-69b46485e3d3.xhtml>

R-squared is a statistical measure of how close the data is to the fitted regression line. R-squared is always between 0 and 100%. The higher the R-squared, the better the model fits your data.

## The R-squared coefficient

The R-squared coefficient, also known as the coefficient of determination, is a measure of how well a model fits a dataset. It is commonly used in statistics. It measures the degree of variation in the target variable; this is explained by the variation in the input features. An R-squared coefficient generally takes a value between 0 and 1, where 1 equates to a perfect fit of the model.

<https://www.safaribooksonline.com/library/view/hands-on-data-science/9781787280748/94105517-242f-47cf-8cb8-ef52bd8dc2aa.xhtml>

how do I know how good my regression is? How well does my line fit my data? That's where r-squared comes in, and r-squared is also known as the coefficient of determination. Again, someone trying to sound smart might call it that, but usually it's called r-squared.

**It is the fraction of the total variation in Y that is captured by your models.** So how well does your line follow that variation that's happening? Are we getting an equal amount of variance on either side of your line or not? That's what r-squared is measuring.
