Ok, so my current curve fitting code has a step that uses scipy.stats to determine the correct distribution based on the data,
distributions = [st.laplace, st.norm, st.expon, st.dweibull, st.invweibull, st.lognorm, st.uniform] mles = [] for distribution in distributions: pars = distribution.fit(data) mle = distribution.nnlf(pars, data) mles.append(mle) results = [(distribution.name, mle) for distribution, mle in zip(distributions, mles)] for dist in sorted(zip(distributions, mles), key=lambda d: d[1]): print dist best_fit = sorted(zip(distributions, mles), key=lambda d: d[1])[0] print 'Best fit reached using {}, MLE value: {}'.format(best_fit[0].name, best_fit[1]) print [mod[0].name for mod in sorted(zip(distributions, mles), key=lambda d: d[1])]
Where data is a list of numerical values. So far, this works great for setting unimodal distributions, confirmed in a script that randomly generates values ββfrom random distributions and uses curve_fit to override the parameters.

Now I would like to make the code able to handle bimodal distributions, for example, the example below:

Is it possible to get MLE for a pair of models from scipy.stats to determine if some pair of distributions is suitable for the data ?, something like
distributions = [st.laplace, st.norm, st.expon, st.dweibull, st.invweibull, st.lognorm, st.uniform] distributionPairs = [[modelA.name, modelB.name] for modelA in distributions for modelB in distributions]
and use these pairs to get the MLE value of this pair of data fitting distributions?