Data Science Explorer

Mean Median Mode 본문

Machine Learning

Mean Median Mode

grace21110 2023. 11. 12. 11:38
반응형
ModeResult(mode=11, count=1)

In machine learning, there are three values. 

 

Mean: the average value 

Median: the mid point value 

Mode: the most common value 

 

  • Mean 

It is the average value, divide the sum by the number of the values 

 

Example 

(99+86+87+88+111+86+103+87+94+78+77+85+86) / 13 = 89.77

import numpy 

speed =[99,86,87,88,111,86,103,87,94,78,77,85,86]

x = numpy.mean(speed)

print(x)
89.76923076923077

 

  • Median 

It is the value in the middle of all the values. 

 

Example 

import numpy as np
height = [163, 154, 170, 175, 185]

x = numpy.median (height)

print(x)
170.0

 

  • Mode 

It appears the most number of the times, the most common number. 


Example

Use scipy to get mode. 

from scipy import stats 

weight = [23, 45, 11, 89]

x = stats.mode(weight) 

print (x)

** Scipy is a computation library that uses Numpy library and used for optimization, stats, and signal processing. **

 

 

'Machine Learning' 카테고리의 다른 글

Machine Learning: Percentiles  (0) 2023.11.14
Machine Learning : Standard Deviation  (0) 2023.11.13
Text Mining #4 Stemming and Lemmatization  (0) 2023.09.06
Text Mining #3 Removing Stop Word  (0) 2023.09.05
Text Mining #2 Text Normalization  (0) 2023.09.05