From d93cd3b7c0d53828d41f21a2c45c239faa6dd68d Mon Sep 17 00:00:00 2001 From: Sofie Van Landeghem Date: Thu, 21 Jan 2021 10:53:16 +0100 Subject: [PATCH] remove artificially duplicated test [ci skip] --- spacy/tests/pipeline/test_textcat.py | 48 ---------------------------- 1 file changed, 48 deletions(-) diff --git a/spacy/tests/pipeline/test_textcat.py b/spacy/tests/pipeline/test_textcat.py index f41ee4bd2..2b01a9cc8 100644 --- a/spacy/tests/pipeline/test_textcat.py +++ b/spacy/tests/pipeline/test_textcat.py @@ -226,54 +226,6 @@ def test_overfitting_IO(): assert_equal(batch_cats_1, no_batch_cats) -@pytest.mark.skip(reason="TODO: Can this be removed?") -def test_overfitting_IO_multi_old(): - # Simple test to try and quickly overfit the multi-label textcat component - ensuring the ML models work correctly - fix_random_seed(0) - nlp = English() - # Set exclusive labels to False - config = {"model": {"linear_model": {"exclusive_classes": False}}} - textcat = nlp.add_pipe("textcat", config=config) - train_examples = [] - for text, annotations in TRAIN_DATA_MULTI_LABEL: - train_examples.append(Example.from_dict(nlp.make_doc(text), annotations)) - optimizer = nlp.initialize(get_examples=lambda: train_examples) - assert textcat.model.get_dim("nO") == 2 - - for i in range(50): - losses = {} - nlp.update(train_examples, sgd=optimizer, losses=losses) - assert losses["textcat"] < 0.01 - - # test the trained model - test_text = "I am happy." - doc = nlp(test_text) - cats = doc.cats - assert cats["POSITIVE"] > 0.9 - - # Also test the results are still the same after IO - with make_tempdir() as tmp_dir: - nlp.to_disk(tmp_dir) - nlp2 = util.load_model_from_path(tmp_dir) - doc2 = nlp2(test_text) - cats2 = doc2.cats - assert cats2["POSITIVE"] > 0.9 - - # Test scoring - scores = nlp.evaluate(train_examples) - assert scores["cats_micro_f"] == 1.0 - assert scores["cats_score"] == 1.0 - assert "cats_score_desc" in scores - - # Make sure that running pipe twice, or comparing to call, always amounts to the same predictions - texts = ["Just a sentence.", "I like green eggs.", "I am happy.", "I eat ham."] - batch_cats_1 = [doc.cats for doc in nlp.pipe(texts)] - batch_cats_2 = [doc.cats for doc in nlp.pipe(texts)] - no_batch_cats = [doc.cats for doc in [nlp(text) for text in texts]] - assert_equal(batch_cats_1, batch_cats_2) - assert_equal(batch_cats_1, no_batch_cats) - - def test_overfitting_IO_multi(): # Simple test to try and quickly overfit the multi-label textcat component - ensuring the ML models work correctly fix_random_seed(0)