The mode

The mode is the most frequently occurring value in the dataset. It is more commonly used for categorical data so that we can find out which category is the most common. One downside to using the mode is that it is not unique. A distribution with two modes is described as bimodal, while one with many modes is described as multimodal. The following code is an illustration of a bimodal distribution with modes at two and seven, since they both occur four times in the dataset:

    In [4]: import matplotlib.pyplot as plt
               %matplotlib inline  
    In [5]: plt.hist([7,0,1,2,3,7,1,2,3,4,2,7,6,5,2,1,6,8,9,7])
               plt.xlabel('x')
               plt.ylabel('Count')
               plt.title('Bimodal distribution')
               plt.show()

The generated bimodal distribution appears as follows:

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset