KindXiaoming / pykan

Kolmogorov Arnold Networks
MIT License
14.98k stars 1.38k forks source link

Example 4 Classification error #382

Open DanielLSM opened 3 months ago

DanielLSM commented 3 months ago

First of all, good work, the project seems well maintained and clean : )

I have an issue around Example 4 - Classification, on the jupyter notebooks. When i try to run after following the instructions, i get this traceback:

{ "name": "TypeError", "message": "recover_save_act_in_fit() missing 1 required positional argument: 'old_save_act'", "stack": "--------------------------------------------------------------------------- TypeError Traceback (most recent call last) Cell In[7], line 9 6 def test_acc(): 7 return torch.mean((torch.argmax(model(dataset['test_input']), dim=1) == dataset['test_label']).type(dtype)) ----> 9 results = model.fit(dataset, opt=\"LBFGS\", steps=20, metrics=(train_acc, test_acc), loss_fn=torch.nn.CrossEntropyLoss());

File ~/test-dev/pykan/kan/MultKAN.py:940, in MultKAN.fit(self, dataset, opt, steps, log, lamb, lamb_l1, lamb_entropy, lamb_coef, lamb_coefdiff, update_grid, grid_update_num, loss_fn, lr, start_grid_update_step, stop_grid_update_step, batch, metrics, save_fig, in_vars, out_vars, beta, save_fig_freq, img_folder, singularity_avoiding, y_th, reg_metric, displaymetrics) 936 for in pbar: 938 if _ == steps-1 and old_save_act: 939 #self.save_act = True --> 940 self.recover_save_act_in_fit() 942 train_id = np.random.choice(dataset['train_input'].shape[0], batch_size, replace=False) 943 test_id = np.random.choice(dataset['test_input'].shape[0], batch_size_test, replace=False)

TypeError: recover_save_act_in_fit() missing 1 required positional argument: 'old_save_act'" }

This happens when I try to train. Any clues? Thanks!

KindXiaoming commented 3 months ago

please pull the lastest version and it should work. Thanks!