deepnog.models package¶
deepnog.models.deepencoding module¶
deepnog.models.deepfam module¶
Author: Lukas Gosch, Roman Feldbauer
- class deepnog.models.deepfam.DeepFam(*args: Any, **kwargs: Any)[source]¶
Bases:
torch.nn.Module
Convolutional network for protein family prediction.
PyTorch implementation of DeepFam architecture (original: TensorFlow).
- Parameters
model_dict (dict) – Dictionary storing the hyperparameters and learned parameters of the model.
- forward(x)[source]¶
Forward a batch of sequences through network.
- Parameters
x (Tensor, shape (batch_size, sequence_len)) – Sequence or batch of sequences to classify. Assumes they are translated using a vocabulary. (See gen_amino_acid_vocab in dataset.py)
- Returns
out – Confidence of sequence(s) beeing in one of the n_classes.
- Return type
Tensor, shape (batch_size, n_classes)
- class deepnog.models.deepfam.DeepFamAblation1(*args: Any, **kwargs: Any)[source]¶
Bases:
deepnog.models.deepfam.DeepFamAblationBase
Ablation study of DeepFam to DeepNOG transition.
Change 1: WordEmbedding instead of PseudoOneHot Change 2: SELU instead of BN/ReLU Change 3: Drop the fully connected layer between ConvNet and classification Combinations: 12, 13, 23, 123 (=DeepNOG).
- Parameters
model_dict (dict) – Dictionary storing the hyperparameters and learned parameters of the model.
- forward(x)[source]¶
Forward a batch of sequences through network.
- Parameters
x (Tensor, shape (batch_size, sequence_len)) – Sequence or batch of sequences to classify. Assumes they are translated using a vocabulary. (See gen_amino_acid_vocab in dataset.py)
- Returns
out – Confidence of sequence(s) being in one of the n_classes.
- Return type
Tensor, shape (batch_size, n_classes)
- class deepnog.models.deepfam.DeepFamAblation12(*args: Any, **kwargs: Any)[source]¶
Bases:
deepnog.models.deepfam.DeepFamAblationBase
Ablation study of DeepFam to DeepNOG transition.
Change 1: WordEmbedding instead of PseudoOneHot Change 2: SELU instead of BN/ReLU Change 3: Drop the fully connected layer between ConvNet and classification Combinations: 12, 13, 23, 123 (=DeepNOG).
- Parameters
model_dict (dict) – Dictionary storing the hyperparameters and learned parameters of the model.
- forward(x)[source]¶
Forward a batch of sequences through network.
- Parameters
x (Tensor, shape (batch_size, sequence_len)) – Sequence or batch of sequences to classify. Assumes they are translated using a vocabulary. (See gen_amino_acid_vocab in dataset.py)
- Returns
out – Confidence of sequence(s) being in one of the n_classes.
- Return type
Tensor, shape (batch_size, n_classes)
- class deepnog.models.deepfam.DeepFamAblation123(*args: Any, **kwargs: Any)[source]¶
Bases:
deepnog.models.deepfam.DeepFamAblationBase
Ablation study of DeepFam to DeepNOG transition.
Change 1: WordEmbedding instead of PseudoOneHot Change 2: SELU instead of BN/ReLU Change 3: Drop the fully connected layer between ConvNet and classification Combinations: 12, 13, 23, 123 (=DeepNOG).
- Parameters
model_dict (dict) – Dictionary storing the hyperparameters and learned parameters of the model.
- forward(x)[source]¶
Forward a batch of sequences through network.
- Parameters
x (Tensor, shape (batch_size, sequence_len)) – Sequence or batch of sequences to classify. Assumes they are translated using a vocabulary. (See gen_amino_acid_vocab in dataset.py)
- Returns
out – Confidence of sequence(s) beeing in one of the n_classes.
- Return type
Tensor, shape (batch_size, n_classes)
- class deepnog.models.deepfam.DeepFamAblation13(*args: Any, **kwargs: Any)[source]¶
Bases:
deepnog.models.deepfam.DeepFamAblationBase
Ablation study of DeepFam to DeepNOG transition.
Change 1: WordEmbedding instead of PseudoOneHot Change 2: SELU instead of BN/ReLU Change 3: Drop the fully connected layer between ConvNet and classification Combinations: 12, 13, 23, 123 (=DeepNOG).
- Parameters
model_dict (dict) – Dictionary storing the hyperparameters and learned parameters of the model.
- forward(x)[source]¶
Forward a batch of sequences through network.
- Parameters
x (Tensor, shape (batch_size, sequence_len)) – Sequence or batch of sequences to classify. Assumes they are translated using a vocabulary. (See gen_amino_acid_vocab in dataset.py)
- Returns
out – Confidence of sequence(s) being in one of the n_classes.
- Return type
Tensor, shape (batch_size, n_classes)
- class deepnog.models.deepfam.DeepFamAblation2(*args: Any, **kwargs: Any)[source]¶
Bases:
deepnog.models.deepfam.DeepFamAblationBase
Ablation study of DeepFam to DeepNOG transition.
Change 1: WordEmbedding instead of PseudoOneHot Change 2: SELU instead of BN/ReLU Change 3: Drop the fully connected layer between ConvNet and classification Combinations: 12, 13, 23, 123 (=DeepNOG).
- Parameters
model_dict (dict) – Dictionary storing the hyperparameters and learned parameters of the model.
- forward(x)[source]¶
Forward a batch of sequences through network.
- Parameters
x (Tensor, shape (batch_size, sequence_len)) – Sequence or batch of sequences to classify. Assumes they are translated using a vocabulary. (See gen_amino_acid_vocab in dataset.py)
- Returns
out – Confidence of sequence(s) being in one of the n_classes.
- Return type
Tensor, shape (batch_size, n_classes)
- class deepnog.models.deepfam.DeepFamAblation23(*args: Any, **kwargs: Any)[source]¶
Bases:
deepnog.models.deepfam.DeepFamAblationBase
Ablation study of DeepFam to DeepNOG transition.
Change 1: WordEmbedding instead of PseudoOneHot Change 2: SELU instead of BN/ReLU Change 3: Drop the fully connected layer between ConvNet and classification Combinations: 12, 13, 23, 123 (=DeepNOG).
- Parameters
model_dict (dict) – Dictionary storing the hyperparameters and learned parameters of the model.
- forward(x)[source]¶
Forward a batch of sequences through network.
- Parameters
x (Tensor, shape (batch_size, sequence_len)) – Sequence or batch of sequences to classify. Assumes they are translated using a vocabulary. (See gen_amino_acid_vocab in dataset.py)
- Returns
out – Confidence of sequence(s) beeing in one of the n_classes.
- Return type
Tensor, shape (batch_size, n_classes)
- class deepnog.models.deepfam.DeepFamAblation3(*args: Any, **kwargs: Any)[source]¶
Bases:
deepnog.models.deepfam.DeepFamAblationBase
Ablation study of DeepFam to DeepNOG transition.
Change 1: WordEmbedding instead of PseudoOneHot Change 2: SELU instead of BN/ReLU Change 3: Drop the fully connected layer between ConvNet and classification Combinations: 12, 13, 23, 123 (=DeepNOG).
- Parameters
model_dict (dict) – Dictionary storing the hyperparameters and learned parameters of the model.
- forward(x)[source]¶
Forward a batch of sequences through network.
- Parameters
x (Tensor, shape (batch_size, sequence_len)) – Sequence or batch of sequences to classify. Assumes they are translated using a vocabulary. (See gen_amino_acid_vocab in dataset.py)
- Returns
out – Confidence of sequence(s) being in one of the n_classes.
- Return type
Tensor, shape (batch_size, n_classes)
deepnog.models.deepnog module¶
Author: Lukas Gosch, Roman Feldbauer
Date: 2019-10-09
Description: Convolutional networks for protein orthologous group assignment.
- class deepnog.models.deepnog.AminoAcidWordEmbedding(*args: Any, **kwargs: Any)[source]¶
Bases:
torch.nn.Module
PyTorch nn.Embedding where each amino acid is considered one word.
- Parameters
embedding_dim (int) – Embedding dimensionality.
- forward(sequence)[source]¶
Embed a given sequence.
- Parameters
sequence (Tensor) – The sequence or a batch of sequences to embed. They are assumed to be translated to numerical values given a generated vocabulary (see gen_amino_acid_vocab in dataset.py)
- Returns
x – The sequence (densely) embedded in a space of dimension embedding_dim.
- Return type
Tensor
- class deepnog.models.deepnog.DeepNOG(*args: Any, **kwargs: Any)[source]¶
Bases:
torch.nn.Module
Convolutional network for protein orthologous group prediction.
Compared to DeepFam, this architecture provides:
learned amino acid embeddings
self-normalizing network with SELU
sequence length independence
stream-lined output layer
This networks consists of an embedding layer which learns a D-dimensional embedding for each amino acid. For a sequence of length L, the embedding has dimension DxL. A 1-D convolution with C filters of F different kernel- sizes K_i are performed over the embedding resulting in Cx(L-K_i-1) output dimension for each kernel size. SeLU activation is applied on the output followed by AdaptiveMaxPooling1D Layer reducing the dimension to of the output layer to Cx1 and resulting in the NN being sequence length independent. The max-pooling layer is followed up by a classic dropout Layer and then by a dense layer with as many output nodes as orthologous groups/protein families to classify.
- Parameters
model_dict (dict) – Dictionary storing the hyperparameters and learned parameters of the model.
Notes
This architecture’s working title was DeepEncoding. The old name was last available in deepnog 1.2.2.
- forward(x)[source]¶
Forward a batch of sequences through network.
- Parameters
x (Tensor, shape (batch_size, sequence_len)) – Sequence or batch of sequences to classify. Assumes they are translated using a vocabulary. (See gen_amino_acid_vocab in dataset.py)
- Returns
out – Confidence of sequence(s) being in one of the n_classes.
- Return type
Tensor, shape (batch_size, n_classes)