From d72029d9c88f479da1b1866ab9998f3427821e2e Mon Sep 17 00:00:00 2001 From: Raphael Mitsch Date: Wed, 11 Oct 2023 12:23:38 +0200 Subject: [PATCH] Add binary examples for Textcat task in `spacy-llm` (#13051) * Add examples for binary classification. * Fix example. * Remove binary textcat example. Format. * Rephrase. --- website/docs/api/large-language-models.mdx | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/website/docs/api/large-language-models.mdx b/website/docs/api/large-language-models.mdx index f8404cb2e..55d137e21 100644 --- a/website/docs/api/large-language-models.mdx +++ b/website/docs/api/large-language-models.mdx @@ -752,6 +752,25 @@ supports `.yml`, `.yaml`, `.json` and `.jsonl`. path = "textcat_examples.json" ``` +If you want to perform few-shot learning with a binary classifier (i. e. a text +either should or should not be assigned to a given class), you can provide +positive and negative examples with answers of "POS" or "NEG". "POS" means that +this example should be assigned the class label defined in the configuration, +"NEG" means it shouldn't. E. g. for spam classification: + +```json +[ + { + "text": "You won the lottery! Wire a fee of 200$ to be able to withdraw your winnings.", + "answer": "POS" + }, + { + "text": "Your order #123456789 has arrived", + "answer": "NEG" + } +] +``` + ### REL {id="rel"} The REL task extracts relations between named entities.