flambe.field.label
¶
Module Contents¶
-
class
flambe.field.label.
LabelField
(one_hot: bool = False, multilabel_sep: Optional[str] = None, labels: Optional[Sequence[str]] = None)[source]¶ Bases:
flambe.field.field.Field
Featurizes input labels.
The class also handles multilabel inputs and one hot encoding.
-
vocab_size
:int[source]¶ Get the vocabulary length.
Returns: The length of the vocabulary Return type: int
-
label_count
:torch.Tensor[source]¶ Get the label count.
Returns: Tensor containing the count for each label, indexed by the id of the label in the vocabulary. Return type: torch.Tensor
-
label_freq
:torch.Tensor[source]¶ Get the frequency of each label.
Returns: Tensor containing the frequency of each label, indexed by the id of the label in the vocabulary. Return type: torch.Tensor
-
label_inv_freq
:torch.Tensor[source]¶ Get the inverse frequency for each label.
Returns: Tensor containing the inverse frequency of each label, indexed by the id of the label in the vocabulary. Return type: torch.Tensor
-