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
I want to run FFTKDE on a custom 2D grid, and found a related issue here: Coming from #15
When I sue the code provided there (with KDEpy Version '1.1.0') I get a grid-must be sorted error
# Create bimodal 2D data data = np.array([[-1, 1], [0, 1], [1, 1], [-1, -1], [0, -1], [1, -1]]) # Create 2D grid grid_x = np.linspace(-2, 2, 2 ** 5) grid_y = np.linspace(-2, 2, 2 ** 4) grid = np.stack(np.meshgrid(grid_x, grid_y), -1).reshape(-1, 2) # density estimates y1 = KDEpy.FFTKDE(bw=0.2).fit(data).evaluate(grid)
What is the recommended way to provide grids then? The documentation only provides a 1D case (y = FFTKDE().fit(data)(np.linspace(-10, 10, num=2**12)))
y = FFTKDE().fit(data)(np.linspace(-10, 10, num=2**12))
The text was updated successfully, but these errors were encountered:
I'm a python novice but there's an example in 2D case:
from mpl_toolkits.mplot3d import Axes3D from matplotlib.colors import LightSource from matplotlib import cm import matplotlib.pyplot as plt import numpy as np ax = plt.subplot(2, 3, 4, projection="3d") plt.title("Kernels normalized in any\ndimension for any $p$-norm", fontsize=6) data = np.array([[0, 0]]) grid_points = 2**6 # Grid points in each dimension from KDEpy import FFTKDE x, z = FFTKDE(kernel="gaussian", bw=1, norm=2).fit(data)((grid_points, grid_points)) x, y = np.unique(x[:, 0]), np.unique(x[:, 1]) x, y = np.meshgrid(x, y) z = z.reshape(grid_points, grid_points).T + 0.1 ls = LightSource(350, 45) rgb = ls.shade(z, cmap=cm.PuBu, vert_exag=0.1, blend_mode="soft") surf = ax.plot_surface( x, y, z, rstride=1, cstride=1, facecolors=rgb, linewidth=0, antialiased=False, shade=True, ) ax.view_init(30, 65) plt.yticks([]) plt.xticks([]) ax.set_zticks([])
Sorry, something went wrong.
Thanks @trungnth !
No branches or pull requests
I want to run FFTKDE on a custom 2D grid, and found a related issue here:
Coming from #15
When I sue the code provided there (with KDEpy Version '1.1.0') I get a grid-must be sorted error
What is the recommended way to provide grids then?
The documentation only provides a 1D case (
y = FFTKDE().fit(data)(np.linspace(-10, 10, num=2**12))
)The text was updated successfully, but these errors were encountered: