KindXiaoming / pykan

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

How to Extract Predicted Values #101

Closed rxa615 closed 3 months ago

rxa615 commented 5 months ago

Firstly, I would like to congratulate the KAN team on their outstanding work. I am currently implementing the KAN for genetic data. My question is, how can we extract the predicted values from the trained model, similar to using model.predict()?

ZacksterUG commented 5 months ago

Like this image

yuedajiong commented 5 months ago

easy!

  1. inference-only mode: You can mimic the logic of training, train and save a checkpoint. During inference, load the checkpoint, prepare the data directly, call forward, and get what you want.
  2. If you want to get results during training, LBFGS is not very intuitive as it requires a closure; you can get it within the closure. If using Adam/SGD, you can directly obtain the predicted results within the training loop.