spaCy/examples/training
adrianeboyd b5d999e510 Add textcat to train CLI (#4226)
* Add doc.cats to spacy.gold at the paragraph level

Support `doc.cats` as `"cats": [{"label": string, "value": number}]` in
the spacy JSON training format at the paragraph level.

* `spacy.gold.docs_to_json()` writes `docs.cats`

* `GoldCorpus` reads in cats in each `GoldParse`

* Update instances of gold_tuples to handle cats

Update iteration over gold_tuples / gold_parses to handle addition of
cats at the paragraph level.

* Add textcat to train CLI

* Add textcat options to train CLI
* Add textcat labels in `TextCategorizer.begin_training()`
* Add textcat evaluation to `Scorer`:
  * For binary exclusive classes with provided label: F1 for label
  * For 2+ exclusive classes: F1 macro average
  * For multilabel (not exclusive): ROC AUC macro average (currently
relying on sklearn)
* Provide user info on textcat evaluation settings, potential
incompatibilities
* Provide pipeline to Scorer in `Language.evaluate` for textcat config
* Customize train CLI output to include only metrics relevant to current
pipeline
* Add textcat evaluation to evaluate CLI

* Fix handling of unset arguments and config params

Fix handling of unset arguments and model confiug parameters in Scorer
initialization.

* Temporarily add sklearn requirement

* Remove sklearn version number

* Improve Scorer handling of models without textcats

* Fixing Scorer handling of models without textcats

* Update Scorer output for python 2.7

* Modify inf in Scorer for python 2.7

* Auto-format

Also make small adjustments to make auto-formatting with black easier and produce nicer results

* Move error message to Errors

* Update documentation

* Add cats to annotation JSON format [ci skip]

* Fix tpl flag and docs [ci skip]

* Switch to internal roc_auc_score

Switch to internal `roc_auc_score()` adapted from scikit-learn.

* Add AUCROCScore tests and improve errors/warnings

* Add tests for AUCROCScore and roc_auc_score
* Add missing error for only positive/negative values
* Remove unnecessary warnings and errors

* Make reduced roc_auc_score functions private

Because most of the checks and warnings have been stripped for the
internal functions and access is only intended through `ROCAUCScore`,
make the functions for roc_auc_score adapted from scikit-learn private.

* Check that data corresponds with multilabel flag

Check that the training instances correspond with the multilabel flag,
adding the multilabel flag if required.

* Add textcat score to early stopping check

* Add more checks to debug-data for textcat

* Add example training data for textcat

* Add more checks to textcat train CLI

* Check configuration when extending base model
* Fix typos

* Update textcat example data

* Provide licensing details and licenses for data
* Remove two labels with no positive instances from jigsaw-toxic-comment
data.


Co-authored-by: Ines Montani <ines@ines.io>
2019-09-15 22:31:31 +02:00
..
ner_example_data Updates/bugfixes for NER/IOB converters (#4186) 2019-08-29 12:04:01 +02:00
textcat_example_data Add textcat to train CLI (#4226) 2019-09-15 22:31:31 +02:00
conllu.py pulling tqdm imports in functions to avoid bug (tmp fix) (#4263) 2019-09-09 16:32:11 +02:00
ner_multitask_objective.py Auto-format examples 2018-12-02 04:26:26 +01:00
pretrain_kb.py Documentation for Entity Linking (#4065) 2019-09-12 11:38:34 +02:00
pretrain_textcat.py pulling tqdm imports in functions to avoid bug (tmp fix) (#4263) 2019-09-09 16:32:11 +02:00
rehearsal.py Tidy up and auto-format [ci skip] 2019-08-31 13:39:31 +02:00
train_entity_linker.py Documentation for Entity Linking (#4065) 2019-09-12 11:38:34 +02:00
train_intent_parser.py Auto-format examples 2018-12-02 04:26:26 +01:00
train_ner.py Test and update examples [ci skip] 2019-03-16 14:15:49 +01:00
train_new_entity_type.py Update compatibility [ci skip] 2019-04-01 16:25:16 +02:00
train_parser.py Test and update examples [ci skip] 2019-03-16 14:15:49 +01:00
train_tagger.py Test and update examples [ci skip] 2019-03-16 14:15:49 +01:00
train_textcat.py Tidy up and auto-format [ci skip] 2019-08-31 13:39:31 +02:00
training-data.json Update Example input JSON file to adhere to specification. (#3243) 2019-02-07 16:18:01 +01:00
vocab-data.jsonl Use even smaller examle size 2017-10-30 19:46:45 +01:00