In machine learning, variance is the difference between the actual samples of the dataset and the predictions made by the model. When working on a regression-based machine learning problem, it is very useful to know how much of the variance is explained by the machine learning model. So, if you want to know how to calculate the explained variance of a machine learning model, this article is for you. In this article, I’ll walk you through what Explained Variance in Machine Learning is and how to calculate it using Python.

## Explained Variance

The explained variance is used to measure the proportion of the variability of the predictions of a machine learning model. Simply put, it is the difference between the expected value and the predicted value. It is a very important concept to understand how much information we can lose by reconciling the dataset.

Hope you now understand the concept of explained variance in machine learning. Always remember to use it when working on regression-based problems to measure the difference between samples and predictions. In the section below, I’ll walk you through its implementation using Python.

## Explained Variance using Python

To calculate the explained variance of a machine learning model, I will first train a machine learning model using the **linear regression** algorithm and then calculate it using the Python programming language:

0.8274789442218667

A machine learning model must have at least 60 per cent of explained variance.

### Summary

In simple words, it is the proportion of the variability of the difference between the actual samples of the dataset and the predictions made by the model. While using it, always remember that the concept of Explained Variance is used to measure the proportion of the variability of the predictions of a regression based machine learning model. I hope you liked this article on the concept of explained variance in machine learning and its implementation using Python. Feel free to ask your valuable questions in the comments section below.

hello sir

first of all your articles are great

i regularly follow them

can you please put a detailed article on hyperparameter optimisation?

sure