0
$\begingroup$

I am doing some work which requires fitting a Gaussian to a cluster of points which is expected to be distributed normally.

I have data which looks like this, you can see the small tightly grouped cluster of points on the left:

enter image description here

I zoom in around the cluster, and use scikit-learn KDE to get a density distribution (with Gaussian kernel), which looks like this:

enter image description here

Then I fit the Gaussian and it turns out to have far too small sigma:

centroid_x: -36.3204357 
centroid_y: -12.8734763
sigma_x:     0.17916588
sigma_y:     0.07428976

enter image description here

From inspection of the density distribution, the x and y sigma should be more on the order of ~1, rather than ~0.1. Does anyone know why this behaviour might be occurring? I don't believe there are significant errors in my code or method, this technique has worked well on other data sets, for example:

enter image description here enter image description here enter image description here

$\endgroup$
4
  • $\begingroup$ Are you isolating the points (i.e., does the data set you're fitting to consist of only the points visible in the second plot)? Do you set initial values? $\endgroup$
    – corey979
    Commented May 18, 2020 at 19:41
  • $\begingroup$ Hi! the fitting is only done with the points shown in the second plot. For initial values I use the mean and standard deviations of the x and y arrays $\endgroup$
    – big daddy
    Commented May 18, 2020 at 19:57
  • $\begingroup$ I am unconvinced there is anything the matter, because you haven't shown the points in sufficient detail. Your graphics and results are perfectly consistent, assuming there is a pile of very closely clustered points near $(-36.5, -13).$ What have you done to investigate this possibility? $\endgroup$
    – whuber
    Commented May 18, 2020 at 20:28
  • 1
    $\begingroup$ Can you post the points you're fitting to, so that we could experiment? $\endgroup$
    – corey979
    Commented May 18, 2020 at 21:04

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.