ClassificationResult

public abstract class ClassificationResult


Represents the classification results of a model. Typically used as a result for classification tasks.

Summary

Public constructors

Public methods

abstract List<Classifications>

The classification results for each head of the model.

static ClassificationResult
create(
    List<Classifications> classifications,
    Optional<Long> timestampMs
)

Creates a ClassificationResult instance.

static ClassificationResult
createFromProto(ClassificationsProto.ClassificationResult proto)

Creates a ClassificationResult object from a ClassificationsProto.ClassificationResult protobuf message.

abstract Optional<Long>

The optional timestamp (in milliseconds) of the start of the chunk of data corresponding to these results.

Public constructors

ClassificationResult

public ClassificationResult()

Public methods

classifications

public abstract List<Classifications> classifications()

The classification results for each head of the model.

create

public static ClassificationResult create(
    List<Classifications> classifications,
    Optional<Long> timestampMs
)

Creates a ClassificationResult instance.

Parameters
List<Classifications> classifications

the list of Classifications objects containing the predicted categories for each head of the model.

Optional<Long> timestampMs

the optional timestamp (in milliseconds) of the start of the chunk of data corresponding to these results.

createFromProto

public static ClassificationResult createFromProto(ClassificationsProto.ClassificationResult proto)

Creates a ClassificationResult object from a ClassificationsProto.ClassificationResult protobuf message.

Parameters
ClassificationsProto.ClassificationResult proto

the ClassificationsProto.ClassificationResult protobuf message to convert.

timestampMs

public abstract Optional<Long> timestampMs()

The optional timestamp (in milliseconds) of the start of the chunk of data corresponding to these results.

This is only used for classification on time series (e.g. audio classification). In these use cases, the amount of data to process might exceed the maximum size that the model can process: to solve this, the input data is split into multiple chunks starting at different timestamps.