Fix exclusive_classes in textcat ensemble (#5166)

Pass the exclusive_classes setting to the bow model within the ensemble
textcat model.
This commit is contained in:
adrianeboyd 2020-03-29 13:52:34 +02:00 committed by GitHub
parent e904958115
commit d47b810ba4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -693,9 +693,11 @@ def build_text_classifier(nr_class, width=64, **cfg):
) )
linear_model = build_bow_text_classifier( 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) output_layer = Softmax(nr_class, nr_class * 2)
else: else:
output_layer = ( output_layer = (