From 0c36b2d63689adc473233be960932f7861d480c7 Mon Sep 17 00:00:00 2001 From: Raphael Mitsch Date: Mon, 9 Oct 2023 12:17:12 +0200 Subject: [PATCH] Add examples for binary classification. --- website/docs/api/large-language-models.mdx | 48 ++++++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/website/docs/api/large-language-models.mdx b/website/docs/api/large-language-models.mdx index f8404cb2e..993b77839 100644 --- a/website/docs/api/large-language-models.mdx +++ b/website/docs/api/large-language-models.mdx @@ -673,6 +673,22 @@ prompt. The formatting of few-shot examples is the same as those for the [v1](#textcat-v1) implementation. +If you want to perform few-shot learning with a binary classifier, you can +provide positive and negative examples - e. g.: + +```json +[ + { + "text": "You won the lottery! Wire a fee of 200$ to be able to withdraw your winnings.", + "answer": "Spam" + }, + { + "text": "Your order #123456789 has arrived", + "answer": "NotSpam" + } +] +``` + #### spacy.TextCat.v2 {id="textcat-v2"} V2 includes all v1 functionality, with an improved prompt template. @@ -702,6 +718,22 @@ V2 includes all v1 functionality, with an improved prompt template. The formatting of few-shot examples is the same as those for the [v1](#textcat-v1) implementation. +If you want to perform few-shot learning with a binary classifier, you can +provide positive and negative examples - e. g.: + +```json +[ + { + "text": "You won the lottery! Wire a fee of 200$ to be able to withdraw your winnings.", + "answer": "Spam" + }, + { + "text": "Your order #123456789 has arrived", + "answer": "NotSpam" + } +] +``` + #### spacy.TextCat.v1 {id="textcat-v1"} Version 1 of the built-in TextCat task supports both zero-shot and few-shot @@ -752,6 +784,22 @@ supports `.yml`, `.yaml`, `.json` and `.jsonl`. path = "textcat_examples.json" ``` +If you want to perform few-shot learning with a binary classifier, you can +provide positive and negative examples - e. g.: + +```json +[ + { + "text": "You won the lottery! Wire a fee of 200$ to be able to withdraw your winnings.", + "answer": "Spam" + }, + { + "text": "Your order #123456789 has arrived", + "answer": "NotSpam" + } +] +``` + ### REL {id="rel"} The REL task extracts relations between named entities.