ssl_tools.experiments.har_classification.tfc
Attributes
Classes
Helper class that provides a standard way to create an ABC using |
|
Helper class that provides a standard way to create an ABC using |
Module Contents
- class ssl_tools.experiments.har_classification.tfc.TFCTest(data, label='standard activity code', encoding_size=128, in_channels=6, length_alignment=178, use_cosine_similarity=True, temperature=0.5, features_as_channels=False, num_classes=6, *args, **kwargs)
Bases:
ssl_tools.experiments.LightningTest
Helper class that provides a standard way to create an ABC using inheritance.
Tests the Temporal Frequency Coding model
Parameters
- encoding_sizeint, optional
Size of the encoding (output of the linear layer). Note that the representation will be of size 2*encoding_size, since the representation is the concatenation of the time and frequency encodings.
- labelstr, optional
Name of the column with the labels.
- encoding_sizeint, optional
Size of the encoding (output of the linear layer). The real size of the representation will be 2*encoding_size, since the representation is the concatenation of the time and frequency encodings.
- in_channelsint, optional
Number of channels in the input data
- length_alignmentint, optional
Truncate the features to this value.
- use_cosine_similaritybool, optional
If True use cosine similarity, otherwise use dot product in the NXTent loss.
- temperaturefloat, optional
Temperature parameter of the NXTent loss.
- features_as_channelsbool, optional
If true, features will be transposed to (C, T), where C is the number of features and T is the number of time steps. If False, features will be (T*C, )
- jitter_ratiofloat, optional
Ratio of the standard deviation of the gaussian noise that will be added to the data.
- num_classesint, optional
Number of classes in the dataset. Only used in finetune mode.
- update_backbonebool, optional
If True, the backbone will be updated during training. Only used in finetune mode.
- _MODEL_NAME = 'TFC'
- Parameters:
data (str)
label (str)
encoding_size (int)
in_channels (int)
length_alignment (int)
use_cosine_similarity (bool)
temperature (float)
features_as_channels (bool)
num_classes (int)
- class ssl_tools.experiments.har_classification.tfc.TFCTrain(data, label='standard activity code', encoding_size=128, in_channels=6, length_alignment=178, use_cosine_similarity=True, temperature=0.5, features_as_channels=False, jitter_ratio=2, num_classes=6, update_backbone=False, *args, **kwargs)
Bases:
ssl_tools.experiments.LightningSSLTrain
Helper class that provides a standard way to create an ABC using inheritance.
Trains the Temporal Frequency Coding model
Parameters
- encoding_sizeint, optional
Size of the encoding (output of the linear layer). Note that the representation will be of size 2*encoding_size, since the representation is the concatenation of the time and frequency encodings.
- labelstr, optional
Name of the column with the labels.
- encoding_sizeint, optional
Size of the encoding (output of the linear layer). The real size of the representation will be 2*encoding_size, since the representation is the concatenation of the time and frequency encodings.
- in_channelsint, optional
Number of channels in the input data
- length_alignmentint, optional
Truncate the features to this value.
- use_cosine_similaritybool, optional
If True use cosine similarity, otherwise use dot product in the NXTent loss.
- temperaturefloat, optional
Temperature parameter of the NXTent loss.
- features_as_channelsbool, optional
If true, features will be transposed to (C, T), where C is the number of features and T is the number of time steps. If False, features will be (T*C, )
- jitter_ratiofloat, optional
Ratio of the standard deviation of the gaussian noise that will be added to the data.
- num_classesint, optional
Number of classes in the dataset. Only used in finetune mode.
- update_backbonebool, optional
If True, the backbone will be updated during training. Only used in finetune mode.
- _MODEL_NAME = 'TFC'
- get_finetune_data_module()
The data module to use for fine-tuning.
Returns
- L.LightningDataModule
The data module to use for fine-tuning
Raises
- NotImplementedError
_description_
- Return type:
lightning.LightningDataModule
- get_finetune_model(load_backbone=None)
Get the model to use for fine-tuning.
Parameters
- load_backbonestr, optional
The path to the backbone to load. The backbone must be loaded inside this method, if it is not None.
Returns
- L.LightningModule
The model to use for fine-tuning
- Parameters:
load_backbone (str)
- Return type:
lightning.LightningModule
- Parameters:
data (str)
label (str)
encoding_size (int)
in_channels (int)
length_alignment (int)
use_cosine_similarity (bool)
temperature (float)
features_as_channels (bool)
jitter_ratio (float)
num_classes (int)
update_backbone (bool)
- ssl_tools.experiments.har_classification.tfc.options