BinClass.Classifier (BinClass v0.3.0)

Copy Markdown View Source

A struct representing a trained binary classifier.

The required :decision_policy field controls how probabilities become a class label. It is either %{strategy: :argmax} or a positive-threshold policy. :minimum_input_tokens is a separate input-validity requirement; inputs below it produce :insufficient_input without hiding probabilities.

:target_mode and :target_threshold record whether hard or soft targets were used during training and how soft targets were binarized for metrics. They do not change inference behavior.

:model_revision identifies the exact graph semantics used for training. It prevents classifiers trained with older masking behavior from silently running against a different graph.

:vocab_size, :pad_token_id, and :unk_token_id are derived from the trained tokenizer and validated when the classifier is serialized or loaded. Persisted output labels are exactly two distinct binaries. Serialization and inference require every field in the current struct schema; the struct does not supply compatibility defaults for manually assembled classifiers.

Summary

Types

t()

A complete, validated binary classifier artifact.

Types

t()

@type t() :: %BinClass.Classifier{
  accuracy: number(),
  architecture: atom(),
  decision_policy: map(),
  dropout_rate: number(),
  epoch: non_neg_integer(),
  labels:
    [String.t()] | %{required(0) => String.t(), required(1) => String.t()},
  learning_rate: number(),
  minimum_input_tokens: non_neg_integer(),
  model_params: term(),
  model_revision: non_neg_integer(),
  pad_token_id: non_neg_integer(),
  target_mode: :hard | :soft,
  target_threshold: number(),
  tokenizer: term(),
  unk_token_id: non_neg_integer(),
  vector_length: pos_integer(),
  vocab_size: pos_integer()
}

A complete, validated binary classifier artifact.

Values returned by BinClass.Trainer.train/2 satisfy this type. Manually constructed structs must provide the complete current schema before they can be serialized or used for inference.