team-daniel / KAN

Implementation on how to use Kolmogorov-Arnold Networks (KANs) for classification and regression tasks.
https://daniel-bethell.co.uk/posts/kan
182 stars 21 forks source link

FileNotFoundError in Classification #5

Closed ChenHuang94 closed 1 week ago

ChenHuang94 commented 2 months ago

When I ran the follow commands: image_folder = 'video_img' model = KAN(width=[4, 5, 3], grid=5, k=3, seed=0, device=device) model(iris_dataset['train_input']) model.plot(beta=100, scale=1, in_vars=['SL', 'SW', 'PL', 'PW'], out_vars=['Set', 'Ver', 'Vir'])

it says the following: Directory already exists: ./model

FileNotFoundError Traceback (most recent call last) Cell In[22], line 6 3 model = KAN(width=[4, 5, 3], grid=5, k=3, seed=0, device=device) 5 model(iris_dataset['train_input']) ----> 6 model.plot(beta=100, scale=1, in_vars=['SL', 'SW', 'PL', 'PW'], out_vars=['Set', 'Ver', 'Vir'])

File E:\anaconda3\lib\site-packages\kan\MultKAN.py:668, in MultKAN.plot(self, folder, beta, mask, metric, scale, tick, sample, in_vars, outvars, title, varscale) 666 id = j 667 path = os.path.dirname(os.path.abspath(file)) + "/assets/img/sum_symbol.png" --> 668 im = plt.imread(path) 669 left = DC_toNFC([1 / (2 * N) + id / N - y2, 0])[0] 670 right = DC_toNFC([1 / (2 * N) + id / N + y2, 0])[0]

File E:\anaconda3\lib\site-packages\matplotlib\pyplot.py:2195, in imread(fname, format) 2193 @_copy_docstring_and_deprecators(matplotlib.image.imread) 2194 def imread(fname, format=None): -> 2195 return matplotlib.image.imread(fname, format)

File E:\anaconda3\lib\site-packages\matplotlib\image.py:1563, in imread(fname, format) 1556 if isinstance(fname, str) and len(parse.urlparse(fname).scheme) > 1: 1557 # Pillow doesn't handle URLs directly. 1558 raise ValueError( 1559 "Please open the URL for reading and pass the " 1560 "result to Pillow, e.g. with " 1561 "np.array(PIL.Image.open(urllib.request.urlopen(url)))." 1562 ) -> 1563 with img_open(fname) as image: 1564 return (_pil_png_to_float_array(image) 1565 if isinstance(image, PIL.PngImagePlugin.PngImageFile) else 1566 pil_to_array(image))

File E:\anaconda3\lib\site-packages\PIL\ImageFile.py:126, in ImageFile.init(self, fp, filename) 122 self.decodermaxblock = MAXBLOCK 124 if is_path(fp): 125 # filename --> 126 self.fp = open(fp, "rb") 127 self.filename = fp 128 self._exclusive_fp = True

FileNotFoundError: [Errno 2] No such file or directory: 'E:\anaconda3\lib\site-packages\kan/assets/img/sum_symbol.png'

Could you plz help me to figure out the problem? Thx!