seqgra.learner.torch.torchhelper module¶
MIT - CSAIL - Gifford Lab - seqgra
PyTorch learner helper class
@author: Konstantin Krismer
- class TorchHelper[source]¶
Bases:
object
- MULTIPLE_REGRESSION_LOSSES: FrozenSet[str] = frozenset({'l1loss', 'mseloss', 'smoothl1loss'})¶
- MULTIVARIATE_REGRESSION_LOSSES: FrozenSet[str] = frozenset({'l1loss', 'mseloss', 'smoothl1loss'})¶
- MULTI_CLASS_CLASSIFICATION_LOSSES: FrozenSet[str] = frozenset({'cosineembeddingloss', 'crossentropyloss', 'hingeembeddingloss', 'kldivloss', 'nllloss'})¶
- MULTI_LABEL_CLASSIFICATION_LOSSES: FrozenSet[str] = frozenset({'bceloss', 'bcewithlogitsloss'})¶
- static create_model(learner: seqgra.learner.learner.Learner) → None[source]¶
- static evaluate_model(learner: seqgra.learner.learner.Learner, dataset: torch.utils.data.dataset.Dataset, output_layer_activation_function: Optional[str] = None)[source]¶
- static get_metrics(learner: seqgra.learner.learner.Learner, output_layer_activation_function: Optional[str] = None)[source]¶
- static get_num_params(learner: seqgra.learner.learner.Learner) → seqgra.schema.ModelSize[source]¶
- static load_model(learner: seqgra.learner.learner.Learner, file_name: Optional[str] = None) → None[source]¶
- static predict(learner: seqgra.learner.learner.Learner, dataset: torch.utils.data.dataset.Dataset, output_layer_activation_function: Optional[str] = None)[source]¶
This is the forward calculation from x to y :returns: Output tensor with the computed logits. :rtype: softmax_linear
- static print_model_summary(learner: seqgra.learner.learner.Learner)[source]¶
- static save_model(learner: seqgra.learner.learner.Learner, file_name: Optional[str] = None) → None[source]¶
- static set_seed(learner: seqgra.learner.learner.Learner) → None[source]¶
- static train_model(learner: seqgra.learner.learner.Learner, training_dataset: torch.utils.data.dataset.Dataset, validation_dataset: torch.utils.data.dataset.Dataset, output_layer_activation_function: Optional[str] = None, silent: bool = False) → None[source]¶
- static train_model_basic(learner: seqgra.learner.learner.Learner, training_dataset: torch.utils.data.dataset.Dataset, validation_dataset: torch.utils.data.dataset.Dataset, output_layer_activation_function: Optional[str] = None, silent: bool = False) → None[source]¶
- static write_session_info(learner: seqgra.learner.learner.Learner) → None[source]¶