spaCy
spaCy copied to clipboard
Add Softmax scorer for spancat
WIP: This PR adds a Softmax scorer for the spancat component that should be used in cases where classes are exclusive.
Description
Spancat currently has a LinearLogistic
layer that creates multilabel annotations on text. However, this is not necessary when classes are exclusive or when spans are non-overlapping. Switching from a LinearLogistic
to a Softmax
layer is recommended. This issue came up when we're doing the spancat experiments.
Usage
In order for the user to switch to spacy.Softmax.v1
, they have to update the config and specify the architecture in the scorer
.
Alternative usage (not yet implemented): Add a parameter, exclusive_classes:bool
(a la textcat
), in the SpanCategorizer
architecture to use Softmax automatically.
Types of change
New feature
Checklist
- [x] I confirm that I have the right to submit this contribution under the project's MIT license.
- [ ] I ran the tests, and all new and existing tests passed.
- [ ] My changes don't require a change to the documentation, or if they do, I've added all required information.
In order for the user to switch to
spacy.Softmax.v1
, they have to update the config and specify the architecture in thescorer
. Alternative usage (not yet implemented): Add a parameter,exclusive_classes:bool
(a latextcat
), in theSpanCategorizer
architecture to use Softmax automatically.
It would make sense to make the implementation & usage consistent with how we do it in textcat
.
After internal conversations: we'll want to implement this as a new component, somewhat similar to textcat
vs textcat_multilabel
. I'll close this PR while we work on a more extensive PR to address that.