autointent.modules.decision.ArgmaxDecision#

class autointent.modules.decision.ArgmaxDecision#

Bases: autointent.modules.base.BaseDecision

Argmax decision module.

The ArgmaxDecision is a simple predictor that selects the class with the highest score (argmax) for single-label classification tasks.

Examples:#

from autointent.modules import ArgmaxDecision
import numpy as np
predictor = ArgmaxDecision()
train_scores = np.array([[0.2, 0.8], [0.7, 0.3]])
labels = [1, 0]  # Single-label targets
predictor.fit(train_scores, labels)
test_scores = np.array([[0.1, 0.9], [0.6, 0.4]])
decisions = predictor.predict(test_scores)
print(decisions)
[1, 0]
name = 'argmax'#

Name of the module.

supports_oos = False#

Whether the module supports oos data

supports_multilabel = False#

Whether the module supports multilabel classification

supports_multiclass = True#

Whether the module supports multiclass classification

classmethod from_context(context)#

Initialize from context.

Parameters:

context (autointent.Context) – Context object containing configurations and utilities

Return type:

ArgmaxDecision

fit(scores, labels, tags=None)#

Fit the predictor (no-op for ArgmaxDecision).

Parameters:
  • scores (numpy.typing.NDArray[Any]) – Array of shape (n_samples, n_classes) with predicted scores

  • labels (autointent.custom_types.ListOfGenericLabels) – List of true labels

  • tags (list[autointent.schemas.Tag] | None) – List of Tag objects for mutually exclusive classes, or None

Raises:

WrongClassificationError – If used on non-single-label data

Return type:

None

predict(scores)#

Predict labels using argmax strategy.

Parameters:

scores (numpy.typing.NDArray[Any]) – Array of shape (n_samples, n_classes) with predicted scores

Returns:

List of predicted class indices

Raises:

MismatchNumClassesError – If the number of classes does not match the trained predictor

Return type:

list[int]