Interface Classifier<INPUT,OUTPUT>

Type Parameters:
INPUT - type of the input data
OUTPUT - type of the output data
All Known Subinterfaces:
TracedClassifier<INPUT,OUTPUT>

public interface Classifier<INPUT,OUTPUT>
A classifier categorizes and labels eval outputs, producing zero or more structured Classification items.

Classifiers run independently from Scorers. Each Classifier exposes a name (used as the span name and as the default grouping key for classifications whose own name is blank).

  • Field Details

  • Method Details

    • getName

      String getName()
    • classify

      List<Classification> classify(TaskResult<INPUT,OUTPUT> taskResult)
      Classifies the result of a successful task execution.
      Parameters:
      taskResult - the task output and originating dataset case
      Returns:
      zero or more classifications. An empty list means "no classifications for this case".
    • of

      static <INPUT, OUTPUT> Classifier<INPUT,OUTPUT> of(String classifierName, Function<TaskResult<INPUT,OUTPUT>,List<Classification>> classifierFn)
      Creates a classifier from a function that returns a (possibly empty or null) list of classifications.

      A null return value is treated as no classifications. Each returned Classification must have a non-blank id; otherwise the classifier throws an exception (which the eval runner records but does not abort on).

    • single

      static <INPUT, OUTPUT> Classifier<INPUT,OUTPUT> single(String classifierName, Function<TaskResult<INPUT,OUTPUT>,Classification> classifierFn)
      Creates a classifier from a function that returns a single classification.

      A null return value is treated as no classifications.