We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hi all,
Thanks for the package, it has been a great help! I am using version 1.1.0. Whenever I try to save a NaiveKDE object with pickle, e.g.
import KDEpy import pickle import numpy as np x = np.random.randn(1000) kde = KDEpy.NaiveKDE('gaussian') kde.fit(x) with open('./kde.pt', 'wb')as f: pickle.dump(kde, f)
I get an error of the sort
7 kde.fit(x) 9 with open('./kde.pt', 'wb')as f: ---> 10 pickle.dump(kde, f) PicklingError: Can't pickle <function gaussian at 0x7f517bca1430>: it's not the same object as KDEpy.kernel_funcs.gaussian
This could be easily resolved by changing lines 328-338 to names not coinciding with the function names, e.g.
gaussian_k = Kernel(gaussian, var=1, support=np.inf) exp_k = Kernel(exponential, var=2, support=np.inf) box_k = Kernel(box, var=1 / 3, support=1) tri_k = Kernel(tri, var=1 / 6, support=1) epa_k = Kernel(epanechnikov, var=1 / 5, support=1) biweight_k = Kernel(biweight, var=1 / 7, support=1) triweight_k = Kernel(triweight, var=1 / 9, support=1) tricube_k = Kernel(tricube, var=35 / 243, support=1) cosine_k = Kernel(cosine, var=(1 - (8 / np.pi**2)), support=1) logistic_k = Kernel(logistic, var=(np.pi**2 / 3), support=np.inf) sigmoid_k = Kernel(sigmoid, var=(np.pi**2 / 4), support=np.inf) _kernel_functions = { "gaussian": gaussian_k, "exponential": exp_k, "box": box_k, "tri": tri_k, "epa": epa_k, "biweight": biweight_k, "triweight": triweight_k, "tricube": tricube_k, "cosine": cosine_k, # 'logistic': logistic_k, # 'sigmoid': sigmoid_k }
The text was updated successfully, but these errors were encountered:
Feel free to add a test and open a pull request on this :) I would merge it if it's as easy as you say!
Sorry, something went wrong.
No branches or pull requests
Hi all,
Thanks for the package, it has been a great help! I am using version 1.1.0.
Whenever I try to save a NaiveKDE object with pickle, e.g.
I get an error of the sort
This could be easily resolved by changing lines 328-338 to names not coinciding with the function names, e.g.
The text was updated successfully, but these errors were encountered: