CODE SetFit w/ SBERT for Text Classification (Few-Shot Learning) multi-class multi-label (SBERT 44)

Поділитися
Вставка
  • Опубліковано 15 вер 2024
  • How-to Code SBERT for Few-Shot Learning (SetFit). SetFit takes advantage of Sentence Transformers’ ability to generate dense embeddings based on paired sentences.
    In the initial fine-tuning phase stage, it makes use of the limited labeled input data by contrastive training, where positive and negative pairs are created by in-class and out-class selection.
    The Sentence Transformer model then trains on these pairs (or triplets) and generates dense vectors per example. In the second step, the classification head trains on the encoded embeddings with their respective class labels.
    At inference time, the unseen example passes through the fine-tuned Sentence Transformer, generating an embedding that when fed to the classification head outputs a class label prediction.
    Given a limited training sample set per class the new SetFit methodology based on SBERT Sentence Transformers perform exceptionally well in text classification. Either multi class or multi label classification of text /sentences.
    Understand the theory behind SetFit and the power of pre-trained SBERT Sentence transformers when applied for "classification based" similarity tasks in NLP.
    All credits to:
    "Efficient Few-Shot Learning Without Prompts"
    arxiv.org/pdf/...
    Next video we will code & fine-tune all hyper-parameters of SetFit in detail and live.
    #setfit
    #sbert
    #naturallanguageprocessing
    #in_context_learning
    #classification

КОМЕНТАРІ • 13