Skip to content

Commit

Permalink
Fix exclusive_classes in textcat ensemble (#5166)
Browse files Browse the repository at this point in the history
Pass the exclusive_classes setting to the bow model within the ensemble
textcat model.
  • Loading branch information
adrianeboyd committed Mar 29, 2020
1 parent e904958 commit d47b810
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions spacy/_ml.py
Original file line number Diff line number Diff line change
Expand Up @@ -693,9 +693,11 @@ def build_text_classifier(nr_class, width=64, **cfg):
)

linear_model = build_bow_text_classifier(
nr_class, ngram_size=cfg.get("ngram_size", 1), exclusive_classes=False
nr_class,
ngram_size=cfg.get("ngram_size", 1),
exclusive_classes=cfg.get("exclusive_classes", False),
)
if cfg.get("exclusive_classes"):
if cfg.get("exclusive_classes", False):
output_layer = Softmax(nr_class, nr_class * 2)
else:
output_layer = (
Expand Down

0 comments on commit d47b810

Please sign in to comment.