dreamquark-ai / tabnet

PyTorch implementation of TabNet paper : https://arxiv.org/pdf/1908.07442.pdf
https://dreamquark-ai.github.io/tabnet/
MIT License
2.65k stars 488 forks source link

ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all() #533

Closed ChiragChauhan4579 closed 10 months ago

ChiragChauhan4579 commented 10 months ago

So I am trying this code and it gives me the error mentioned in title

BS=1024 MAX_EPOCH=101

N_D = 128 N_A = 32 N_INDEP = 1 N_SHARED = 1 N_STEPS = 3

unsupervised_model = TabNetPretrainer( optimizer_fn=torch.optim.Adam, optimizer_params=dict(lr=2e-2), mask_type='entmax' # "sparsemax" )

unsupervised_model.fit( X_train=x_train.values, eval_set=x_test.values, pretraining_ratio=0.8, )

I don't understand what is the problem here. The moment I remove eval_set the training works.

Optimox commented 10 months ago

Looks like you did not carefully read the documentation or look into an example notebook. Simply change to a list of np.array : eval_set=[x_test.values]