[Numpy-discussion] Univariate and multivariate density estimation using Python

Jon Saenz jsaenz at wm.lc.ehu.es
Tue Sep 12 11:56:16 EDT 2000


Hello, all.

I am announcing a C extension module which computes univariate and
multivariate probability density functions by means of a kernel-based
approach.

The module includes functions to perform the estimation using the
following kernels:
* One-dimensional data:
	Epanechnikov
	Biweight
	Triangular
* 2 or 3-dimensional data:
	Epanechnikov
	Multivariate gaussian

For multivariate data, there is the optional feature of scaling each axis 
by means of a matrix. This approach allows the definition of Fukunaga-type
estimators.

The functions in the module are used as follows:

import KPDF
# edata and gdata must be numpy arrays of shapes (N,) and (E,) 
# while h is a scalar
# pdf1 is a numpy array which holds the PDF evaluated at points
# gdata with experimental data in edata. pdf1.shape=(E,)
pdf1=KPDF.UPDFEpanechnikov(edata,gdata,h)

# For multivariate estimation, edata and gdata must be numpy arrays of
# shapes (N,2|3) and (E,2|3) while h is a scalar
# pdf2 is a numpy array which holds the PDF evaluated at points
# gdata with experimental data in edata. pdf2.shape=(E,)
pdf2=KPDF.MPDFEpanechnikov(e2data,g2data,h)

# For Fukunaga-type estimators, Sm1 must be a numpy array 2x2(3x3)
# and holds the covariance matrix. sqrtdetS is the square root of the
# determinant 
pdf2=KPDF.MPDFEpanechnikov(e2data,g2data,h,Sm1,sqrtdetS)

There is not a lot of documentation in the module, but I have a serious
commitment of preparing it soon.

It can be downloaded from:
http://starship.python.net/crew/jsaenz/KPDF.tar.gz

Feedback of interested users will be greatly appreciated.

Regards.


Jon Saenz.				| Tfno: +34 946012470
Depto. Fisica Aplicada II               | Fax:  +34 944648500
Facultad de Ciencias.   \\ Universidad del Pais Vasco \\
Apdo. 644   \\ 48080 - Bilbao  \\ SPAIN




More information about the NumPy-Discussion mailing list