KindXiaoming / pykan

Kolmogorov Arnold Networks
MIT License
14.56k stars 1.33k forks source link

Why do you need test data in fit? #391

Open MDcod opened 1 month ago

MDcod commented 1 month ago

Hi! Why do we need to provide both training and test data as input when training? As if in classical models you only need to pass training input and training output and that's enough. Why do we need this extra data here? Why am I asking: we want to compare the model on open benchmarks and be sure that we are training our model on exactly the same data sets as the other participants. The benchmark provides training input and training output for training and test input for prediction. Now we have to pass test input to the fit method and we are not at all sure that this does not affect the quality of the prediction.

chen-erqi commented 1 month ago

Maybe you can edit the source code to close the test data in fit.

seyidcemkarakas commented 1 month ago

Hi! Why do we need to provide both training and test data as input when training? As if in classical models you only need to pass training input and training output and that's enough. Why do we need this extra data here? Why am I asking: we want to compare the model on open benchmarks and be sure that we are training our model on exactly the same data sets as the other participants. The benchmark provides training input and training output for training and test input for prediction. Now we have to pass test input to the fit method and we are not at all sure that this does not affect the quality of the prediction.

I think for neural networks you should provide validaiton data while training. For KAN I did something like that:

First ı divided data into 3 part = trianining, validation and test (OOT dont touch, this is for final performance) with training and validation data you can train your model like that:

final_model.train({'train_input': X_train_tensor, 'train_label': y_train_tensor, 'test_input': X_val_tensor, 'test_label': y_val_tensor},
                      opt="Adam", 
                      steps=100, 
                      lamb=0.01,
                      loss_fn=torch.nn.L1Loss())

Dictionary wants test_input but I provide X_val (validation). That's my solution. and here is OOT prediction

test_preds = final_model.forward(X_test_tensor).detach()