class documentation

Mixin for Transformers that can generate embeddings.

Method embed Generates an embedding for the given data.
Method embed_all Generates embeddings for the given iterable of data.
Property has_embeddings Whether this instance has embeddings.
Method _embed Undocumented

Inherited from EmbeddingsMixin:

Method get_embeddings Returns the embeddings generated by the last forward pass of the model.
def embed(self, arg): (source)

Generates an embedding for the given data.

Subclasses can override this method to increase efficiency, but, by default, this method simply calls predict and then returns get_embeddings.

Parameters
argthe data. See predict for details
Returns
a numpy array containing the embedding
def embed_all(self, args): (source)

Generates embeddings for the given iterable of data.

Subclasses can override this method to increase efficiency, but, by default, this method simply iterates over the data and applies embed to each.

Parameters
argsan iterable of data. See predict_all for details
Returns
a numpy array containing the embeddings stacked along axis 0
@property
has_embeddings = (source)

Whether this instance has embeddings.

def _embed(self, args): (source)

Undocumented