jina.executors.encoders.numeric

class jina.executors.encoders.numeric.TransformEncoder(output_dim=64, model_path=None, random_state=2020, *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.

post_init()[source]

Initialize class attributes/members that can/should not be (de)serialized in standard way.

Examples:

  • deep learning models

  • index files

  • numpy arrays

Warning

All class members created here will NOT be serialized when calling save(). Therefore if you want to store them, please override the __getstate__().

Return type

None

train(data, *args, **kwargs)[source]

Train this executor, need to be overrided

Return type

None

encode(data, *args, **kwargs)[source]
Parameters

data (ndarray) – a B x T numpy ndarray, B is the size of the batch

Return type

ndarray

Returns

a B x D numpy ndarray