crested.tl.extract_layer_embeddings#
- crested.tl.extract_layer_embeddings(input, model, layer_name, genome=None, **kwargs)#
Extract embeddings from a specified layer for all inputs.
- Parameters:
input (
str
|list
[str
] |ndarray
|AnnData
) – Input data to get embeddings for. Can be a (list of) sequence(s), a (list of) region name(s), a matrix of one hot encodings (N, L, 4), or an AnnData object with region names as its var_names.model (
Model
) – A trained keras model from which to extract the embeddings.layer_name (
str
) – The name of the layer from which to extract the embeddings.genome (
Union
[Genome
,PathLike
,None
] (default:None
)) – Genome or path to the genome fasta. Required if no genome is registered and input is an anndata object or region names.**kwargs – Additional keyword arguments to pass to the keras.Model.predict method.
- Return type:
- Returns:
Embeddings of shape (N, D), where N is the number of regions in the input and D is the size of the embedding layer.