
Before modeling, we have specified the custom functions for our error metrics as seen in the below example.This is achieved using createDataPartition() method. The next step is to segregate the data into training and test datasets.Initially, we load our dataset using the read.csv() function.In this example, we have implemented the concept of R square error metric on the Linear Regression model. SStot: It represents the total sum of the errors.Īlways remember, Higher the R square value, better is the predicted model!.

SSres: The sum of squares of the residual errors.The R squared value ranges between 0 to 1 and is represented by the below formula: Thus, an R-squared model describes how well the target variable is explained by the combination of the independent variables as a single unit. It represents the value of how much the independent variables are able to describe the value for the response/target variable. R squared (R2) is a regression error metric that justifies the performance of the model. While R square is an important error metric to evaluate the predictions made by a regression algorithm. We have the Confusion Matrix to deal with and evaluate Classification algorithms. There are various error metric models depending upon the class of algorithm. Let us first understand the importance of error metrics in the domain of Data Science and Machine Learning!!Įrror metrics enable us to evaluate the performance of a machine learning model on a particular dataset. Hello, readers! In this article, we would be walking through an important concept in Machine Learning - R squared (R2) in R programming.
