Download as pdf or txt
Download as pdf or txt
You are on page 1of 7

Variance and Covariance in

Machine Learning
Variance

Covariance
In statistics and machine
learning, variance and
covariance are two measures
that quantify different types of
relationships between variables.

Understanding these concepts


can be essential for feature
selection, model training, and
evaluation.
Variance

Variance measures how far a set of numbers are


spread out from their average value.

Swipe left to find the python code for calculating


the variance
Python code for calculating variance:
Covariance

Covariance measures the extent to which two


variables change together. If the value is positive,
it means when one variable increases, the other
also tends to increase. If it is negative, it means
when one variable increases, the other tends to
decrease.

Swipe left to find the python code for calculating


the covariance
Python code for calculating covariance:

Note that np.cov returns the covariance


matrix, and we select [0, 1] to get the
covariance between x and y.
Importance in Machine Learning

Variance: Understanding the variance


can help in feature scaling and
knowing which features are
contributing more to the model's
performance.

Covariance: Understanding how


different features relate to each other
can help in feature selection and can
inform you if features are redundant.

By understanding these concepts, you can make


more informed decisions when constructing and
optimizing machine learning models.

You might also like