[SciPy-User] Trouble with gaussian_kde on uniform integer data, possibly deprecation error

Jacob Biesinger jake.biesinger at gmail.com
Fri May 28 12:30:22 EDT 2010


Hi!

Having some trouble with a gaussian_kde on uniform integer data.

$ python --version
Python 2.6.5
$ ipython --Version
0.10
$ ipython
In [1]: from scipy.stats import gaussian_kde
In [2]: import scipy
In [3]: randDistFromCenter = map(int, scipy.rand(10000) * 500 - 250)  #
should be uniform on [-250,250)
In [4]: k = gaussian_kde(randDistFromCenter)
/usr/lib/python2.6/dist-packages/scipy/stats/stats.py:1486:
DeprecationWarning: scipy.stats.cov is deprecated; please update your code
to use numpy.cov.
Please note that:
    - numpy.cov rowvar argument defaults to true, not false
    - numpy.cov bias argument defaults to false, not true

  """, DeprecationWarning)
/usr/lib/python2.6/dist-packages/scipy/stats/stats.py:420:
DeprecationWarning: scipy.stats.mean is deprecated; please update your code
to use numpy.mean.
Please note that:
    - numpy.mean axis argument defaults to None, not 0
    - numpy.mean has a ddof argument to replace bias in a more general
manner.
      scipy.stats.mean(a, bias=True) can be replaced by numpy.mean(x,
axis=0, ddof=1).
  axis=0, ddof=1).""", DeprecationWarning)

In [5]: x = scipy.linspace(-300,300,100)
In [6]: y = k.evaluate(x)
In [7]: y
Out[7]:
array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
       0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
       0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
       0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
       0, 0, 0, 0, 0, 0, 0, 0])


#  Perhaps it's a bandwidth issue, though there should still be at least a
few non-zero entries!:
In [8]: k.covariance
Out[8]: array([[ 523.56767608]])


--
Jake Biesinger
Graduate Student
Xie Lab, UC Irvine
(949) 231-7587
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.scipy.org/pipermail/scipy-user/attachments/20100528/422fdaa7/attachment.html>


More information about the SciPy-User mailing list