-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added support for OneClassSVM for single class classification / outli…
…er detection #12
- Loading branch information
1 parent
786f7c0
commit ad7a4db
Showing
6 changed files
with
142 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import pytest | ||
import spacy | ||
|
||
from classy_classification.examples.data import training_data_single_class | ||
|
||
|
||
@pytest.fixture | ||
def spacy_external_single_label(): | ||
nlp = spacy.blank("en") | ||
nlp.add_pipe( | ||
"text_categorizer", | ||
config={"data": training_data_single_class}, | ||
) | ||
return nlp | ||
|
||
|
||
def test_spacy_external_single_label(spacy_external_single_label): | ||
_ = spacy_external_single_label(training_data_single_class["politics"][0]) | ||
_ = spacy_external_single_label.pipe(training_data_single_class["politics"]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import pytest | ||
import spacy | ||
|
||
from classy_classification.examples.data import training_data_single_class | ||
|
||
|
||
@pytest.fixture(params=["en_core_web_md", "en_core_web_trf"]) | ||
def spacy_internal_single_label(request): | ||
nlp = spacy.load(request.param) | ||
nlp.add_pipe("text_categorizer", config={"data": training_data_single_class}) | ||
return nlp | ||
|
||
|
||
def test_spacy_internal_single_label(spacy_internal_single_label): | ||
_ = spacy_internal_single_label(training_data_single_class["politics"][0]) | ||
_ = spacy_internal_single_label.pipe(training_data_single_class["politics"]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import pytest | ||
|
||
from classy_classification import ClassyClassifier | ||
from classy_classification.examples.data import training_data_single_class | ||
|
||
|
||
@pytest.fixture | ||
def standalone_single_label(): | ||
classifier = ClassyClassifier(data=training_data_single_class) | ||
return classifier | ||
|
||
|
||
def test_standalone_single_label(standalone_single_label): | ||
_ = standalone_single_label(training_data_single_class["politics"][0]) | ||
_ = standalone_single_label.pipe(training_data_single_class["politics"]) |