You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
import seaborn as sns
from KDEpy import FFTKDE
import numpy as np
penguins = sns.load_dataset("penguins")
chinstrap = penguins[penguins["species"]=="Chinstrap"].iloc[:,2:6].dropna()
fit=FFTKDE().fit(chinstrap.to_numpy())
lengthspace = np.linspace(25,65,5)
depthspace = np.linspace(10,25,5)
flipperspace = np.linspace(150,250,5)
massspace = np.linspace(2000,8000,5)
def gridcreator1(space1,space2,space3,space4):
grid = []
for s1 in space1:
for s2 in space2:
for s3 in space3:
for s4 in space4:
row = np.array([s1,s2,s3,s4])
grid.append(row)
return grid
testgrid = gridcreator1(lengthspace,depthspace,flipperspace,massspace)
result = fit.evaluate(testgrid)
produces error:
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
Cell In[9], line 27
23 return grid
25 testgrid = gridcreator1(lengthspace,depthspace,flipperspace,massspace)
---> 27 result = fit.evaluate(testgrid)
File E:\anaconda3\envs\analysis\Lib\site-packages\KDEpy\FFTKDE.py:145, in FFTKDE.evaluate(self, grid_points)
143 # Extra verification for FFTKDE (checking the sorting property)
144 if not grid_is_sorted(self.grid_points):
--> 145 raise ValueError("The grid must be sorted.")
147 if isinstance(self.bw, numbers.Number) and self.bw > 0:
148 bw = self.bw
ValueError: The grid must be sorted.
casting testgrid as np array fixes this
result = fit.evaluate(np.asarray(testgrid))
works as intended (I hope).
The text was updated successfully, but these errors were encountered:
produces error:
casting testgrid as np array fixes this
result = fit.evaluate(np.asarray(testgrid))
works as intended (I hope).
The text was updated successfully, but these errors were encountered: