spaCy/spacy/tests/pipeline
Adriane Boyd f99d6d5e39
Refactor scoring methods to use registered functions (#8766)
* Add scorer option to components

Add an optional `scorer` parameter to all pipeline components. If a
scoring function is provided, it overrides the default scoring method
for that component.

* Add registered scorers for all components

* Add `scorers` registry
* Move all scoring methods outside of components as independent
  functions and register
* Use the registered scoring methods as defaults in configs and inits

Additional:

* The scoring methods no longer have access to the full component, so
  use settings from `cfg` as default scorer options to handle settings
  such as `labels`, `threshold`, and `positive_label`
* The `attribute_ruler` scoring method no longer has access to the
  patterns, so all scoring methods are called
* Bug fix: `spancat` scoring method is updated to set `allow_overlap` to
  score overlapping spans correctly

* Update Russian lemmatizer to use direct score method

* Check type of cfg in Pipe.score

* Fix check

* Update spacy/pipeline/sentencizer.pyx

Co-authored-by: Sofie Van Landeghem <svlandeg@users.noreply.github.com>

* Remove validate_examples from scoring functions

* Use Pipe.labels instead of Pipe.cfg["labels"]

Co-authored-by: Sofie Van Landeghem <svlandeg@users.noreply.github.com>
2021-08-10 15:13:39 +02:00
..
__init__.py Revert #4334 2019-09-29 17:32:12 +02:00
test_analysis.py Simplify pipe analysis 2020-08-01 13:40:06 +02:00
test_annotates_on_update.py Tidy up and auto-format 2021-07-18 15:44:56 +10:00
test_attributeruler.py Refactor scoring methods to use registered functions (#8766) 2021-08-10 15:13:39 +02:00
test_entity_linker.py Tidy up with flake8: imports, comparisons, etc. 2021-06-28 12:08:15 +02:00
test_entity_ruler.py Filter W036 for entity ruler, etc. (#8424) 2021-06-21 09:34:29 +02:00
test_functions.py Add token_splitter component (#6726) 2021-01-17 19:54:41 +08:00
test_initialize.py Test with default value 2020-09-29 17:00:40 +02:00
test_lemmatizer.py Tidy up and auto-format 2021-07-18 15:44:56 +10:00
test_models.py Tidy up code 2021-06-28 12:08:15 +02:00
test_morphologizer.py Handle unset token.morph in Morphologizer (#6704) 2021-01-15 17:20:10 +01:00
test_pipe_factories.py Tidy up code 2021-06-28 12:08:15 +02:00
test_pipe_methods.py Tidy up and auto-format 2021-07-18 15:44:56 +10:00
test_sentencizer.py Refactor Docs.is_ flags (#6044) 2020-09-17 00:14:01 +02:00
test_senter.py adding tests for trained models to ensure predict reproducibility 2020-10-13 21:07:13 +02:00
test_spancat.py Auto-format code with black (#8895) 2021-08-06 13:38:06 +02:00
test_tagger.py negative tag annotation (#8731) 2021-07-19 14:39:11 +02:00
test_textcat.py Raise an error for textcat with <2 labels (#8584) 2021-07-06 12:35:22 +02:00
test_tok2vec.py Tidy up code 2021-06-28 12:08:15 +02:00