On 2014-10-10 00:10, Benjamin Blumer wrote: > Hi all, > > I see that gmm.score(x) returns the log probability of x for that > point. I'm interested in integrating this probability over a region. > For example, finding the probability of a ball being in the space > (x,y,z) +/- (delta_x, delta_y, delta_z). In this example, I'd be > using past ball locations as training data. > > So the solution seems to be to integrate the probability density > function (returned by gmm.score()) over the region of interest. Right > now I'm using Scipy's integrate.nquad method. But, coupling that with > gmm.score is SLOW. I've attached an example that takes > 10 minutes > to compute on my i7. The example is in 7D because my actual use case > is in 7D. The region is pretty small -- though the actual region I'll > be using is bigger. Think delta = 0.1. > > I'm wondering: Is there a way to speed this up? An analytical method > to do this? A built in method?
scipy.stats.mvn is a small module that wraps a FORTRAN library that integrates a multivariate Gaussian distribution over a (hyper)rectangular region. The function you want is scipy.stats.mvn.mvndst(). See the FORTRAN source for the arguments: https://github.com/scipy/scipy/blob/master/scipy/stats/mvndst.f#L78-L118 You will have to call this once for each Gaussian component in the mixture and then do the appropriately-weighted sum. -- 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 ------------------------------------------------------------------------------ Meet PCI DSS 3.0 Compliance Requirements with EventLog Analyzer Achieve PCI DSS 3.0 Compliant Status with Out-of-the-box PCI DSS Reports Are you Audit-Ready for PCI DSS 3.0 Compliance? Download White paper Comply to PCI DSS 3.0 Requirement 10 and 11.5 with EventLog Analyzer http://p.sf.net/sfu/Zoho _______________________________________________ Scikit-learn-general mailing list Scikit-learn-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/scikit-learn-general