class jina.executors.classifiers.BaseClassifier(*args, **kwargs)[source]

Bases: jina.executors.BaseExecutor

The base class of Classifier Executor. Classifier Executor allows one to perform classification and regression on given input and output the predicted hard/soft label.

This class should not be used directly. Subclasses should be used.

predict(content, *args, **kwargs)[source]

Perform hard/soft classification on data, the predicted value for each sample in X is returned.

The output value can be zero/one, for one-hot label; or float for soft-label or regression label. Use the corresponding driver to interpret these labels

The size and type of output can be one of the follows, B is data.shape[0]:
  • (B,) or (B, 1); zero/one or float

  • (B, L): zero/one one-hot or soft label for L-class multi-class classification

  • content (np.ndarray) – the input data to be classified, can be a ndim array. where axis=0 represents the batch size, i.e. data[0] is the first sample, data[1] is the second sample, data[n] is the n sample

  • args – Additional positional arguments

  • kwargs – Additional keyword arguments

Return type