mirror of
https://github.com/explosion/spaCy.git
synced 2025-07-10 16:22:29 +03:00
Also test max cuts with NER overfitting
This commit is contained in:
parent
10f5e9413d
commit
0f3b23420b
|
@ -540,11 +540,13 @@ def test_block_ner():
|
||||||
assert [token.ent_type_ for token in doc] == expected_types
|
assert [token.ent_type_ for token in doc] == expected_types
|
||||||
|
|
||||||
|
|
||||||
def test_overfitting_IO():
|
@pytest.mark.parametrize("max_moves", [0, 1, 5, 100])
|
||||||
|
def test_overfitting_IO(max_moves):
|
||||||
fix_random_seed(1)
|
fix_random_seed(1)
|
||||||
# Simple test to try and quickly overfit the NER component
|
# Simple test to try and quickly overfit the NER component
|
||||||
nlp = English()
|
nlp = English()
|
||||||
ner = nlp.add_pipe("ner", config={"model": {}})
|
ner = nlp.add_pipe("ner", config={"model": {}})
|
||||||
|
ner.cfg["update_with_oracle_cut_size"] = max_moves
|
||||||
train_examples = []
|
train_examples = []
|
||||||
for text, annotations in TRAIN_DATA:
|
for text, annotations in TRAIN_DATA:
|
||||||
train_examples.append(Example.from_dict(nlp.make_doc(text), annotations))
|
train_examples.append(Example.from_dict(nlp.make_doc(text), annotations))
|
||||||
|
|
Loading…
Reference in New Issue
Block a user