Scipy kstest problem

I am fitting mixture models to data and assessing how mixtures with more or less components will fit the data. To do this, I am going to plot the cdf of the empirical data and the cdf of my mixture model with k components. As an example, here is a cdf of the empirical data plotted beside a mixture of lognormal distributions with 2 components.

My question is: how do I use scipy's kstest to determine the goodness of fit for the mixture model on the empirical data?

ss.kstest(Y,y_cdf)

Above is the code that I tried where Y is the data I used to fit the model and make the empirical cdf and y_cdf is the cdf of the mixture model.

I am unsure if this is correct as the value for D returned seems quite high.

Topic goodness-of-fit scipy python

Category Data Science

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.