Chambon2018
documentation¶
This page details the implementation of the chambon2018
model published here.
To train the model one could use the train -experiment chambon2018
command.
physioex.train.networks.chambon2018.Chambon2018Net
¶
Bases: SeqtoSeq
A neural network model based on Chambon et al. (2018).
This model utilizes an epoch encoder and a sequence encoder for classification.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
module_config |
The configuration for the model. |
module_config
|
Returns:
Type | Description |
---|---|
torch.Tensor: The computed loss value. |
Source code in physioex/train/networks/chambon2018.py
__init__(module_config=module_config)
¶
Source code in physioex/train/networks/chambon2018.py
compute_loss(embeddings, outputs, targets, log='train', log_metrics=False)
¶
Computes the loss for the Chambon2018Net model.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
embeddings |
The embeddings. |
required | |
outputs |
The model outputs. |
required | |
targets |
The target values. |
required | |
log |
str
|
The logging information. |
'train'
|
log_metrics |
bool
|
Whether to log metrics. |
False
|
Returns:
Type | Description |
---|---|
torch.Tensor: The computed loss value. |
Source code in physioex/train/networks/chambon2018.py
physioex.train.networks.chambon2018.SequenceEncoder
¶
Bases: Module
The sequence encoder neural network module used in Chambon 2018.
This module encodes the input sequences by concatenating them and using a linear layer to perform classification.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
input_dim |
int
|
The dimension of the input. |
required |
n_classes |
int
|
The number of classes for classification. |
required |
latent_dim |
int
|
The dimension of the latent space i.e. intermediate layer between encodings and classification. |
required |
Returns:
Type | Description |
---|---|
torch.Tensor: The output tensor after classification. |
Source code in physioex/train/networks/chambon2018.py
__init__(input_dim, n_classes, latent_dim)
¶
Source code in physioex/train/networks/chambon2018.py
forward(x)
¶
Forward pass of the sequence encoder.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
x |
torch.Tensor - The input tensor. |
required |
Returns:
Type | Description |
---|---|
torch.Tensor: The output tensor after classification. |
Source code in physioex/train/networks/chambon2018.py
encode(x)
¶
Encodes the input tensor.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
x |
torch.Tensor - The input tensor. |
required |
Returns:
Type | Description |
---|---|
torch.Tensor: The encoded tensor. |