mirror of
https://github.com/explosion/spaCy.git
synced 2025-04-20 00:51:58 +03:00
Add examples for binary classification.
This commit is contained in:
parent
030d63ad73
commit
0c36b2d636
|
@ -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.
|
||||
|
|
Loading…
Reference in New Issue
Block a user