jina.executors.encoders.numeric

class jina.executors.encoders.numeric.TransformEncoder(model_path=None, *args, **kwargs)[source]

Bases: jina.executors.encoders.BaseNumericEncoder

TransformEncoder encodes data from an ndarray in size B x T into an ndarray in size B x D

Parameters
  • model_path (Optional[str]) – path from where to pickle the sklearn model.

  • args – Extra positional arguments to be set

  • kwargs – Extra keyword arguments to be set

post_init()[source]

Load the model from path if :param:`model_path` is set.

Return type

None

encode(data, *args, **kwargs)[source]
Parameters
  • data (ndarray) – a B x T numpy ndarray, B is the size of the batch

  • args – Extra positional arguments to be set

  • kwargs – Extra keyword arguments to be set

Return type

ndarray

Returns

a B x D numpy ndarray