autointent.modules.decision.ArgmaxDecision#

class autointent.modules.decision.ArgmaxDecision#

Bases: autointent.modules.abc.DecisionModule

Argmax decision module.

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

Variables:

n_classes – Number of classes in the dataset.

Examples#

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

Initialize form context.

Parameters:

context (autointent.Context) – Context

Return type:

ArgmaxDecision

fit(scores, labels, tags=None)#

Argmax not fitting anything.

Parameters:
  • scores (numpy.typing.NDArray[Any]) – Scores to fit

  • labels (list[autointent.custom_types.LabelType]) – Labels to fit

  • tags (list[autointent.schemas.Tag] | None) – Tags to fit

Raises:

WrongClassificationError – If the classification is wrong.

Return type:

None

predict(scores)#

Predict the argmax.

Parameters:

scores (numpy.typing.NDArray[Any]) – Scores to predict

Raises:

InvalidNumClassesError – If the number of classes is invalid.

Return type:

numpy.typing.NDArray[Any]

dump(path)#

Dump.

Parameters:

path (str) – Dump path.

Return type:

None

load(path)#

Load.

Parameters:

path (str)

Return type:

None