codingstreets
Search
Close this search box.
machine-learning-standard-deviation

Introduction to Machine Learning Standard Deviation

In This Article, You Will Learn About Standard Deviation.

Machine Learning Standard Deviation – Before moving ahead, let’s take a look at Introduction to Machine Learning – MMM

Table of Contents

Standard Deviation

What is Standard Deviation?

A Standard Deviation is a value or data that represents how much value or information is different from the mean value.

If the Standard Deviation is close to Zero, it means its data points are close to the mean.

A high or low standard deviation shows data points are respectively above or below the mean.

The NumPy module has a method to calculate the standard deviation.

Standard Deviation is often represented by the symbol Sigma: σ

Example: Use the Numpy std() method to find out the Standard Deviation.

				
					import numpy as np

Marks = [45, 35, 78, 19, 59, 61, 78, 98, 78, 45]

x = np.std(Marks)

print(x)

				
			
				
					Output - 

22.742910983425144
				
			

As shown above, it returned Standard Deviation.

It shows that low SD data leads to low range of numbers.

Let’s take another example –

Example: Use the Numpy std() method to find out the Standard Deviation.

				
					import numpy as np

Marks = [180, 350, 110, 190, 509, 601, 178]

x = np.std(Marks)

print(x)

				
			
				
					Output - 

174.9366065937333
				
			

As shown above, it returned Standard Deviation.

It shows that high SD data leads to high range of numbers.

Variance

Variance is another way to show how much the number is high.

Variance is often represented by the symbol Sigma Square: σ2

You can get the standard deviation by taking the square root of variance!

√81 = 9

Or, the reverse is true: multiply the standard deviation by yourself to get the variance.

9*9  =  81

The following steps can be used to calculate the variance.

  1. Find the mean
  2. For each value: find the difference from the mean.
  3. For each difference: find the square value.
  4. The variance is the average number of these squared differences.

Let’s follow the above steps to find out the variance.

Mean –

(10+12+14+16+20) / 5 = 16.4

Find the difference from mean for each value –

10 – 16.4 = -6.4

12 – 16.4 = -4.4

14 – 16.4 = -2.4

16 – 16.4 = -0.4

20 – 16.4 = 4.4

Find the square value of each difference –

(-6.4)2    = 40.96

(-4.4)2    = 19.36

(-2.4)2    = 5.76

(-0.4)2    = 0.16

(4.4)2     = 19.36         

The variance is the average number of these squared differences.

(40.96 + 19.39 + 5.76 +0.16 + 19.36) / 5 = 17.126.

Now, let’s find out the variance with Numpy.

Example: Use the Numpy var() method to find out the Standard Deviation.

				
					import numpy as np

Marks = [45, 35, 78, 19, 59, 61, 78, 98, 78, 45]

x = np.var(Marks)

print(x)

				
			
				
					Output - 

517.24
				
			

As a result, it returned the Variance from the given data.

If you find anything incorrect in the above-discussed topic and have any further questions, please comment below.

Connect on:

Recent Post

Popular Post

Top Articles

Archives
Categories

Share on