probml / pmtk3

Probabilistic Modeling Toolkit for Matlab/Octave.
MIT License
1.55k stars 797 forks source link

Fit a frequency curve using Least Square and MLE #111

Closed ghost closed 8 years ago

ghost commented 8 years ago

On An Absolute Criterion for Fitting Frequency Curves http://www.jstor.org/stable/2246266

R.A Fisher said in this essay that "it(Least Square Method) is obviously inapplicable to fit frequency curve".

The following is a proof-of-concept demo that shows one CAN fit a frequency curve using Least Square and it's "good to the eye", quantitativly good and fast. The result is also compared with MLE which is proposed in this essay as well.

The only trick for using least square is that one has to scale the loss function to help optimizer cope with numerical instability caused by probability density functions.

murphyk commented 8 years ago

I just pushed some changes that will will break your demo (slight change to interface). PTAL and make another pull request if you like.