Page 298 - Ai_C10_Flipbook
P. 298
To calculate mode in Python:
[1]: import statistics
marks=[45,34,41,46,47,39,38,48,45,34,41,39,39]
m=statistics.mode(marks)
print("the most frequent marks :",m)
the most frequent marks : 39
Standard Deviation
It is the measure of dispersion of a set of data from its mean. The higher the dispersion of the data, the greater
is the standard deviation and vice versa.
(x - mean) 2
The formula for calculation: =
n
To calculate Standard Deviation in Python:
[1]: import statistics
marks=[45,34,41,46,47,39,38,48,45,34,41,39,39]
m=statistics.stdev(marks)
print("the standard deviation of marks :",round(m,2))
the standard deviation of marks : 4.66
Variance
It means how far each number in the given dataset is from the mean value. It is calculated as the average of the
squares of the differences between an individual value and the expected value or average squared deviation of
each number from the mean of a given data set.
(x - μ) 2
The formula for calculation for variance is: 2 =
n
To calculate Variance in Python:
[1]: import statistics
marks=[45,34,41,46,47,39,38,48,45,34,41,39,39]
m=statistics.variance(marks)
print("the variance of marks :",round(m,2))
the variance of marks : 21.69
NLTK
The Natural Language Toolkit (NLTK) is one of the most commonly used open-source NLP toolkit that is made
up of Python libraries and is used for building programs that help in synthesis and statistical analysis of human
language processing. The text processing libraries do text processing through tokenization, parsing, classification,
stemming, tagging and semantic reasoning.
Installing NLTK
To install NLTK open command prompt in your computer and type:
pip install nltk
296 Artificial Intelligence Play (Ver 1.0)-X

