[Scipy-svn] r2273 - in trunk/Lib/sandbox/pyem: . pyem
scipy-svn at scipy.org
scipy-svn at scipy.org
Thu Oct 12 09:46:45 EDT 2006
Author: cdavid
Date: 2006-10-12 08:46:30 -0500 (Thu, 12 Oct 2006)
New Revision: 2273
Added:
trunk/Lib/sandbox/pyem/LICENSE.txt
trunk/Lib/sandbox/pyem/pyem/info.py
Modified:
trunk/Lib/sandbox/pyem/Changelog
trunk/Lib/sandbox/pyem/MANIFEST.in
trunk/Lib/sandbox/pyem/README
trunk/Lib/sandbox/pyem/pyem/__init__.py
trunk/Lib/sandbox/pyem/pyem/densities.py
trunk/Lib/sandbox/pyem/pyem/gauss_mix.py
trunk/Lib/sandbox/pyem/pyem/gmm_em.py
trunk/Lib/sandbox/pyem/pyem/profile_gmm.py
Log:
[pyem @ david at ar.media.kyoto-u.ac.jp-20060804104819-ba816b64678ea5d2]
Push to version 0.4.2
David Cournapeau <david at ar.media.kyoto-u.ac.jp> | 2006-08-04 19:48:19 +0900 (Fri, 04 Aug 2006)
Modified: trunk/Lib/sandbox/pyem/Changelog
===================================================================
--- trunk/Lib/sandbox/pyem/Changelog 2006-10-12 13:46:06 UTC (rev 2272)
+++ trunk/Lib/sandbox/pyem/Changelog 2006-10-12 13:46:30 UTC (rev 2273)
@@ -1,3 +1,10 @@
+pyem (0.4) Fri, 04 Aug 2006 19:37:47 +0900
+
+ * put version to 0.4.2
+ * adapt to new version of numpy (1.0b2SVN)
+
+-- David Cournapeau <david at ar.media.kyoto-u.ac.jp>
+
pyem (0.4) Fri, 14 Jul 2006 17:49:57 +0900
* put version to 0.4.1
Added: trunk/Lib/sandbox/pyem/LICENSE.txt
===================================================================
--- trunk/Lib/sandbox/pyem/LICENSE.txt 2006-10-12 13:46:06 UTC (rev 2272)
+++ trunk/Lib/sandbox/pyem/LICENSE.txt 2006-10-12 13:46:30 UTC (rev 2273)
@@ -0,0 +1,29 @@
+Copyright (c) 2001, 2002 Enthought, Inc.
+
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+ a. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+ b. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+ c. Neither the name of the Enthought nor the names of its contributors
+ may be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR
+ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
+DAMAGE.
+
Modified: trunk/Lib/sandbox/pyem/MANIFEST.in
===================================================================
--- trunk/Lib/sandbox/pyem/MANIFEST.in 2006-10-12 13:46:06 UTC (rev 2272)
+++ trunk/Lib/sandbox/pyem/MANIFEST.in 2006-10-12 13:46:30 UTC (rev 2273)
@@ -2,3 +2,4 @@
include pyem/src/c_python.pxd
include Changelog
include TODO
+include LICENSE.txt
Modified: trunk/Lib/sandbox/pyem/README
===================================================================
--- trunk/Lib/sandbox/pyem/README 2006-10-12 13:46:06 UTC (rev 2272)
+++ trunk/Lib/sandbox/pyem/README 2006-10-12 13:46:30 UTC (rev 2273)
@@ -1,12 +1,25 @@
-Last Change: Wed Jul 12 04:00 PM 2006 J
+Last Change: Fri Aug 04 07:00 PM 2006 J
+Version 0.4.2
+
pyem is a python module build upon numpy and scipy
(see http://www.scipy.org/) for learning mixtures models
using Expectation Maximization. For now, only Gaussian
Mixture Models are implemented. Included features:
- - computation of Gaussian pdf for multi-variate Gaussian
- random vectors (spherical, diagonal and full covariance matrices)
- - Sampling of Gaussian Mixtures Models
- - Confidence ellipsoides with probability 0.5
- - Classic EM for Gaussian Mixture Models
- - K-mean based initialization
+
+ * computation of Gaussian pdf for multi-variate Gaussian
+ random vectors (spherical, diagonal and full covariance matrices)
+ * Sampling of Gaussian Mixtures Models
+ * Confidence ellipsoides with probability (fixed level of
+ 0.39 for now)
+ * Classic EM for Gaussian Mixture Models
+ * K-mean based and random initialization for EM available
+
+Has been tested on the following platforms:
+
+ * Ubuntu dapper, bi Xeon 3.2 Ghz, 2 Go RAM
+ python 2.4 + pyrex, numpy 1.0.b2SVN + scipy 0.5.1SVN, uses atlas3-sse2
+ * Ubuntu dapper, pentium M 1.2 ghz,. 512 Mo Ram
+ python 2.4 + pyrex, numpy 1.0.b2SVN + scipy 0.5.1SVN, uses atlas3-sse2
+ * Ubuntu dapper, minimac (ppc G4 1.42 Ghz, 1Gb RAM)
+ python 2.4 + pyrex, numpy 1.0.b2SVN + scipy 0.5.1SVN, uses atlas3-sse2
Modified: trunk/Lib/sandbox/pyem/pyem/__init__.py
===================================================================
--- trunk/Lib/sandbox/pyem/pyem/__init__.py 2006-10-12 13:46:06 UTC (rev 2272)
+++ trunk/Lib/sandbox/pyem/pyem/__init__.py 2006-10-12 13:46:30 UTC (rev 2273)
@@ -1,7 +1,7 @@
#! /usr/bin/env python
-# Last Change: Fri Jul 14 05:00 PM 2006 J
+# Last Change: Fri Aug 04 07:00 PM 2006 J
-version = '0.4.1'
+version = '0.4.2'
from gauss_mix import GmParamError, GM
from gmm_em import GmmParamError, GMM
Modified: trunk/Lib/sandbox/pyem/pyem/densities.py
===================================================================
--- trunk/Lib/sandbox/pyem/pyem/densities.py 2006-10-12 13:46:06 UTC (rev 2272)
+++ trunk/Lib/sandbox/pyem/pyem/densities.py 2006-10-12 13:46:30 UTC (rev 2273)
@@ -1,7 +1,7 @@
#! /usr/bin/python
#
# Copyrighted David Cournapeau
-# Last Change: Fri Jul 14 05:00 PM 2006 J
+# Last Change: Fri Aug 04 07:00 PM 2006 J
import numpy as N
import numpy.linalg as lin
@@ -146,13 +146,13 @@
# n = N.size(x, 0)
# y = N.zeros(n, float)
# for i in range(n):
- # y[i] = N.matrixmultiply(x[i,:],
- # N.matrixmultiply(inva, N.transpose(x[i,:])))
+ # y[i] = N.dot(x[i,:],
+ # N.dot(inva, N.transpose(x[i,:])))
# y *= -0.5
# we are using a trick with sum to "emulate"
# the matrix multiplication inva * x without any explicit loop
- y = N.matrixmultiply((x-mu), inva)
+ y = N.dot((x-mu), inva)
y = -0.5 * N.sum(y * (x-mu), 1)
if not log:
@@ -197,8 +197,8 @@
mu = mu[dim]
if mode == 'diag':
va = va[dim]
- elps = N.outerproduct(mu, N.ones(npoints, float))
- elps += N.matrixmultiply(N.diag(N.sqrt(va)), circle)
+ elps = N.outer(mu, N.ones(npoints, float))
+ elps += N.dot(N.diag(N.sqrt(va)), circle)
elif mode == 'full':
va = va[c,:][:,c]
# Method: compute the cholesky decomp of each cov matrix, that is
@@ -209,8 +209,8 @@
# - va = cova' * cova (matlab)
# So take care when comparing results with matlab !
cova = lin.cholesky(va)
- elps = N.outerproduct(mu, N.ones(npoints, float))
- elps += N.matrixmultiply(cova, circle)
+ elps = N.outer(mu, N.ones(npoints, float))
+ elps += N.dot(cova, circle)
else:
raise DenParam("var mode not recognized")
@@ -225,7 +225,7 @@
va = abs(randn(1, d))
elif mode == 'full':
va = randn(d, d)
- va = matrixmultiply(va, va.transpose())
+ va = dot(va, va.transpose())
input = randn(n, d)
output = gauss_den(input, mu, va)
@@ -374,7 +374,7 @@
# Generate a multivariate gaussian of mean mu and covariance va
X = randn(1e3, 2)
- Yc = N.matrixmultiply(N.diag(N.sqrt(va)), X.transpose())
+ Yc = N.dot(N.diag(N.sqrt(va)), X.transpose())
Yc = Yc.transpose() + mu
# Plotting
@@ -391,7 +391,7 @@
# Generate a multivariate gaussian of mean mu and covariance va
X = randn(1e3, 2)
- Yc = N.matrixmultiply(lin.cholesky(va), X.transpose())
+ Yc = N.dot(lin.cholesky(va), X.transpose())
Yc = Yc.transpose() + mu
# Plotting
Modified: trunk/Lib/sandbox/pyem/pyem/gauss_mix.py
===================================================================
--- trunk/Lib/sandbox/pyem/pyem/gauss_mix.py 2006-10-12 13:46:06 UTC (rev 2272)
+++ trunk/Lib/sandbox/pyem/pyem/gauss_mix.py 2006-10-12 13:46:30 UTC (rev 2273)
@@ -1,5 +1,5 @@
# /usr/bin/python
-# Last Change: Fri Jul 14 05:00 PM 2006 J
+# Last Change: Fri Aug 04 07:00 PM 2006 J
# Module to implement GaussianMixture class.
@@ -194,7 +194,7 @@
# different
invcdf = N.cumsum(p)
uni = rand(n)
- index = N.zeros(n)
+ index = N.zeros(n, dtype=int)
# This one should be a bit faster
for k in range(len(p)-1, 0, -1):
Modified: trunk/Lib/sandbox/pyem/pyem/gmm_em.py
===================================================================
--- trunk/Lib/sandbox/pyem/pyem/gmm_em.py 2006-10-12 13:46:06 UTC (rev 2272)
+++ trunk/Lib/sandbox/pyem/pyem/gmm_em.py 2006-10-12 13:46:30 UTC (rev 2273)
@@ -1,5 +1,5 @@
# /usr/bin/python
-# Last Change: Fri Jul 14 05:00 PM 2006 J
+# Last Change: Fri Aug 04 07:00 PM 2006 J
import numpy as N
import numpy.linalg as lin
@@ -129,7 +129,7 @@
# multiply by the weight
tgd *= self.gm.w
# Normalize to get a pdf
- gd = tgd / N.sum(tgd, axis=1)[:, N.NewAxis]
+ gd = tgd / N.sum(tgd, axis=1)[:, N.newaxis]
return gd, tgd
Added: trunk/Lib/sandbox/pyem/pyem/info.py
===================================================================
--- trunk/Lib/sandbox/pyem/pyem/info.py 2006-10-12 13:46:06 UTC (rev 2272)
+++ trunk/Lib/sandbox/pyem/pyem/info.py 2006-10-12 13:46:30 UTC (rev 2273)
@@ -0,0 +1,9 @@
+"""
+Routines for for Gaussian Mixture Models
+and Expectation Maximization learning
+===================================
+
+Copyright: David Cournapeau 2006
+License: BSD-style (see LICENSE.txt in main source directory)
+"""
+
Modified: trunk/Lib/sandbox/pyem/pyem/profile_gmm.py
===================================================================
--- trunk/Lib/sandbox/pyem/pyem/profile_gmm.py 2006-10-12 13:46:06 UTC (rev 2272)
+++ trunk/Lib/sandbox/pyem/pyem/profile_gmm.py 2006-10-12 13:46:30 UTC (rev 2273)
@@ -1,5 +1,4 @@
import numpy as N
-import tables
from gmm_em import GM, GMM
import copy
More information about the Scipy-svn
mailing list