bio_embeddings.project¶
Visualize high dimensional data with t-SNE or UMAP projections or project Bert embeddings with Tucker
-
class
bio_embeddings.project.
PBTucker
(model_file: Union[str, pathlib.Path], device: torch.device)[source]¶ Tucker is a contrastive learning model trained to distinguish CATH superfamilies.
It consumes prottrans_bert_bfd embeddings and reduces the embedding dimensionality from 1024 to 128. See https://www.biorxiv.org/content/10.1101/2021.01.21.427551v1
To use it outside of the pipeline, first instantiate it with pb_tucker = PBTucker(“/path/to/model”, device), then project your reduced bert embedding with pb_tucker.project_reduced_embedding(bert_embedding).
-
__init__
(model_file: Union[str, pathlib.Path], device: torch.device)[source]¶ Initialize self. See help(type(self)) for accurate signature.
-
-
class
bio_embeddings.project.
PBTuckerModel
[source]¶ This is the torch module behind
PBTucker
-
forward
(data: None._VariableFunctionsClass.tensor) → None._VariableFunctionsClass.tensor[source]¶ Defines the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Module
instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
-