klotz: zero-shot*

0 bookmark(s) - Sort by: Date ↓ / Title / - Bookmarks from other users for this tag

  1. This article introduces Scikit-LLM, a Python library that integrates large language models like OpenAI's GPT with the Scikit-learn framework to simplify text analysis tasks. It explains and demonstrates two primary classification methods: zero-shot classification, which assigns labels based solely on the model's general knowledge without prior examples, and few-shot classification, which uses a small set of labeled examples within the prompt to improve accuracy. By following a Scikit-learn-style workflow using fit() and predict() methods, users can easily implement these advanced NLP techniques for tasks such as sentiment analysis and topic labeling.
  2. A practical pipeline for classifying messy free-text data into meaningful categories using a locally hosted LLM, no labeled training data required.
  3. Zero-Shot Classification
    To perform zero shot classification, we want to predict labels for our samples without any training. To do this, we can simply embed short descriptions of each label, such as positive and negative, and then compare the cosine distance between embeddings of samples and label descriptions.

    As shown above, zero-shot classification with embeddings can lead to great results, especially when the labels are more descriptive than just simple words.

    The highest similarity label to the sample input is the predicted label. We can also define a prediction score to be the difference between the cosine distance to the positive and to the negative label. This score can be used for plotting a precision-recall curve, which can be used to select a different tradeoff between precision and recall, by selecting a different threshold.

Top of the page

First / Previous / Next / Last / Page 1 of 0 SemanticScuttle - klotz.me: Tags: zero-shot

About - Propulsed by SemanticScuttle