Wednesday, 23 July 2014

How to fit data to a normal distribution using MLE and Python

MLE, distribution fittings and model calibrating are for sure fascinating topics. Furthermore, from the outside, they might appear to be rocket science. As far I'm concerned, when I did not know what MLE was and what you actually do when trying to fit data to a distribution, all these tecniques did looked exactly like rocket science.
They are not that much complicated though. MLE is a technique that enables you to estimate the parameters of a certain random variable given only a sample by generating a distribution which makes the observed results the most likely to have occurred. Distribution fittings, as far as I know, is the process of actually calibrating the parameters to fit the distribution to a series of observed data.

Let's see an example of MLE and distribution fittings with Python. You need to have installed scipy, numpy and matplotlib in order to perform this although I believe this is not the only way possible. For some reason that I ignore, the methods in scipy.stats related to the normal distribution use loc to indicate the mean and scale to indicate the standard deviation. I maybe can grasp why use "scale" to indicate the stdv however I really do not get "loc" I do not understand why... If you know that, please leave a comment.

The result should look somewhat like this:






Hope this was useful.

10 comments:

  1. It’s really a nice and useful piece of information. I am glad that you shared this useful information with us. Please keeps us to date like this .thank you for sharing.
    Python in-house Corporate training in Nigeria

    ReplyDelete
  2. IB Schools in Delhi At Apeejay School International , the Best IB Schools in Delhi where these skills not only help students navigate academic subjects effectively but also prepare them to succeed in their future careers and daily lives. The International Baccalaureate (IB) framework, known for its rigorous and comprehensive approach to education, provides an ideal foundation for fostering these skills.

    ReplyDelete
  3. Wonderful post! If anyone’s looking for quality schooling, St. Wilfred’s is hands down the Best school in Navi Mumbai. They offer everything from smart classrooms to excellent sports training.

    ReplyDelete
  4. Good post overall, I want to tell about an education center that’s making a real difference. Their curriculum balances academics, sports, and arts while also supporting emotional well-being. With a progressive vision and great faculty, it rightly deserves the title of Best school in jaipur. Highly recommended!

    ReplyDelete
  5. The post was informative, and I’d like to tell about the Best School in Thane that blends academic excellence with character building. The school promotes creativity, discipline, and leadership through a nurturing environment.

    ReplyDelete
  6. The details provided were thorough. I would like to tell you about a school that prioritizes student well-being alongside academic success. Its balanced approach makes it the best school in panvel.

    ReplyDelete
  7. Recent insights led me to an institution fostering both academic brilliance and character—rightfully counted among the Best schools in jaipur.

    ReplyDelete