autointent.modules.scoring.GCNScorer#

class autointent.modules.scoring.GCNScorer(embedder_config=None, label_embedder_config=None, gcn_hidden_dims=None, p_reweight=0.2, tau_threshold=0.4, num_train_epochs=10, batch_size=16, learning_rate=0.001, seed=42, device=None, early_stopping_config=None)#

Bases: autointent.modules.scoring._torch.base_scorer.BaseTorchTrainerScorer

Graph Convolutional Network (GCN) scorer for intent classification.

This module uses a GCN to model label correlations for multi-label text classification. It leverages embeddings for both utterances and labels (descriptions/names) to learn a classifier for each label.

Parameters:
  • embedder_config (autointent.configs.EmbedderConfig | str | dict[str, Any] | None) – Config for utterance embedder.

  • label_embedder_config (autointent.configs.EmbedderConfig | str | dict[str, Any] | None) – Config for label description embedder.

  • gcn_hidden_dims (list[int] | None) – List of hidden dimensions for GCN layers.

  • p_reweight (float) – Reweighting parameter for the correlation matrix.

  • tau_threshold (float) – Threshold for creating the adjacency matrix.

  • num_train_epochs (pydantic.PositiveInt) – Number of training epochs.

  • batch_size (pydantic.PositiveInt) – Batch size for training.

  • learning_rate (float) – Learning rate for the optimizer.

  • seed (int) – Random seed for reproducibility.

  • device (str | None) – Device to train on (‘cpu’, ‘cuda’, etc.).

  • early_stopping_config (autointent.configs.EarlyStoppingConfig | dict[str, Any] | None) – Configuration for early stopping.

Reference:

Chen, Z. M., Wei, X. S., Wang, P., & Guo, Y. (2019). Multi-Label Image Recognition with Graph Convolutional Networks. arXiv preprint arXiv:1904.03582.

name = 'gcn'#
supports_multiclass = True#
supports_multilabel = True#
embedder_config#
label_embedder_config#
gcn_hidden_dims = None#
p_reweight = 0.2#
tau_threshold = 0.4#
classmethod from_context(context, embedder_config=None, label_embedder_config=None, gcn_hidden_dims=None, p_reweight=0.2, tau_threshold=0.4, num_train_epochs=10, batch_size=16, learning_rate=0.001, seed=42, early_stopping_config=None)#
Parameters:
Return type:

GCNScorer

get_implicit_initialization_params()#
Return type:

dict[str, Any]

get_train_data(context)#
Parameters:

context (autointent.Context)

Return type:

tuple[list[str], autointent.custom_types.ListOfLabels, list[str]]

fit(utterances, labels, descriptions)#
Parameters:
  • utterances (list[str])

  • labels (autointent.custom_types.ListOfLabels)

  • descriptions (list[str])

Return type:

None

predict(utterances)#
Parameters:

utterances (list[str])

Return type:

numpy.typing.NDArray[Any]

clear_cache()#
Return type:

None