setfit icon indicating copy to clipboard operation
setfit copied to clipboard

No predictions from setfit

Open simran-padam opened this issue 2 years ago • 5 comments

I ran SetFitTrainer to train the model with 5 classes (used multi_target_strategy="one-vs-rest"). My target variable was one hot encoded. When I get my predictions on the test data, I observe for most of the rows (close to 40% of test data), I have no class predictions meaning it is not predicting any class.

Has any experienced this issue before and can provide any suggestions.

Thanks

simran-padam avatar Mar 29 '23 17:03 simran-padam

Hello!

That's interesting. Do you have any small example (e.g., with toy sklearn data) that reproduces the issue or do you think it's specific to your data?

kgourgou avatar Apr 11 '23 09:04 kgourgou

Hii! I think it is specific to my data. I ran few examples earlier on toy data and saw no issues there. Doesn't Setfit uses softmax on the top layer, it is strange it did not predict any class.

simran-padam avatar Apr 11 '23 16:04 simran-padam

Yeah, very weird. May I ask which version of SetFit you are using? Is it the latest?

Also, what does the loss look like during training? Is that also weird?

kgourgou avatar Apr 16 '23 18:04 kgourgou

Hi Simran, I experienced a similar issue using setfit. Did you figure out what the problem is?

leavoigt avatar Sep 06 '23 13:09 leavoigt

Doesn't Setfit uses softmax on the top layer, it is strange it did not predict any class.

Missed this question. Vanilla SetFit uses a scikit-learn LogisticRegression model on top of the sentence-transformer embeddings.

kgourgou avatar Sep 06 '23 14:09 kgourgou