Page 233 - AI Ver 1.0 Class 10
P. 233

Mode

                 Mode is the most frequent value that occurs in a given dataset. There is no specific mathematical formula to
                 calculate mode. To calculate mode in Python:

                     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)
                 Output will be:

                     the middle value of the sorted marks in class : 39


                 Standard Deviation
                 Standard deviation 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.

                 The formula for calculating standard deviation:




                 Where, ‘σ’ represents standard deviation.
                 To calculate standard deviation in Python:

                     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))
                 Output will be:
                     the standard deviation of marks : 4.66


                 Variance

                 Variance 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.
                 The mathematical formula for calculating variance:

                                                      Variance =

                 To calculate variance in Python:
                     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))
                 Output will be:
                     the variance of marks : 21.69

                                                                                              Data Science  231
   228   229   230   231   232   233   234   235   236   237   238