Skip to content

Multidimensional output -> need loss and doc #21

@meilame-tayebjee

Description

@meilame-tayebjee

Multidimensional output (for a text, prediction is a vector instead of an int)

Use cases:

  • Multilabel ground truth (Request: Support for Multilabel #10) -> (0 1 ... 0 1.. 0) (size of this vector is vocab size)
  • Hierarchical classification / simultaneous multiclass classif: one int per "level" of the nomenclature, or per output "type" (for instance if we want to simultaneously predict the topic + sentiment of a text...) -> (5 32 56 1) (size of this vector is number of levels/types)
  • Soft classification : instead of having one single label as ground truth, any label has a certain probability to be true -> (0.1 0.8 0 0 .. 0.1). It can be either in a multiclass (competition between label) or multilabel mode (several labels can be true)
    • in the multiclass mode, you want to use nn.CrossEntropyLoss() and your output will sum to 1 (probability distribution) -> you may also want to enforce that the ground truth should sum to 1
    • in the multilabel mode, you will apply nn.BCEwithLogitsLoss()to each coordinate of your logits vector - no sum to 1 constraint at all (i.e. you could typically have (0.1 0.8 0 0.7 0.2) as prediction (or ground truth)

Examples illustrating of all these use cases would be nice.

Metadata

Metadata

Labels

documentationImprovements or additions to documentationenhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions