Multidimensional Fitting

Robert Kern robert.kern at gmail.com
Tue Jul 20 22:22:27 EDT 2010


On 7/20/10 10:13 PM, D2Hitman wrote:
>
> I want to fit an n-dimensional distribution with an n-dimensional gaussian.
> So far i have managed to do this in 2d (see below). I am not sure how to
> convert this to work in n-dimensions. Using "ravel" on the arrays is not
> ideal, but optimize does not appear to work on multidimensional arrays. It
> seems "meshgrid" also does not translate to nd.

You will want to ask scipy questions on the scipy mailing list:

   http://www.scipy.org/Mailing_Lists

Don't try to fit a Gaussian to a histogram using least-squares. It's an awful 
way to estimate the parameters. Just use np.mean() and np.cov() to estimate the 
mean and covariance matrix directly.

-- 
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
  that is made terrible by our own mad attempt to interpret it as though it had
  an underlying truth."
   -- Umberto Eco




More information about the Python-list mailing list