0
votes
import numpy as np
from fastkde import fastKDE
import pylab as PP

#Generate two random variables dataset (representing 100000 pairs of datapoints)
N = 2 * 10**5
var1 = np.array(50*np.random.normal(size=N) + 0.1)
var2 = np.array(0.01*np.random.normal(size=N) - 300)

#Do the self-consistent density estimate
myPDF,axes = fastKDE.pdf(var1,var2)

I get this error

 ValueError: inputArray does not appear to be array like.  Error was: Buffer dtype mismatch, expected 'intp_t' but got 'long' 

What is intp_t data type? How do I correct this??? Am new to Python.

On line numbers, etc. attached is the 2 page output of my jupyter notebook: Jupyter notebook output:

1
When you ask about errors, you need to also specify where that error occurs (some or all of the error stack). I'm guessing its in the last expression, theint-_t error suggests it's rather buried in the pdf function. What does fastKDE.pdf accept as inputs? Your 2 variables are float arrays. - hpaulj
Are you using the latest version of fastkde? Try pip install --upgrade fastkde. - fukanchik
I did upgrade to the latest version. Issue still exists. On line numbers, etc. attached is the 2 page output of my jupyter notebook: dropbox.com/s/sdg8d7mcz1ajqi2/issueFastKDE.pdf?dl=0 - hearse
Looks like you are just using the example on pypi.python.org/pypi/fastkde/1.0.9. You have an extra np.array wrapper on var1/2, but I don't think that matters (it's not needed). I'd suggest running their example exactly, and then ask the developers if you still have problems. And change tags if there is one for this package. And run it in regular terminal or Ipython session, just to make sure the notebook iterface isn't in the way. - hpaulj

1 Answers

0
votes

To debug the problem, you must first check that the version that you pip-installed in the one used in the notebook.

  1. Have you restarted the notebook since updating? If not the old version is still used.
  2. Use print(fastKDE.__version__) to verify that you use the up-to-date version. pip lists "1.0.11" but the fastKDE.__version__ actually returns "1.12.0rc2".
  3. I the version is not the latest one, check what is the interpreter in the notebook with import sys ; print(sys.executable). This will return the path to the "appropriate" Python. If it not the same as the Python that pip uses (check with python3 -c 'import pip; print(pip.sys.executable)' update the post for how to proceed.
  4. If you actually use the most recent fastkde and still have the bug (I don't have it with your code), contact the authors of the package for more info.