- class braindecode.models.EEGModuleMixin(n_outputs: int | None = None, n_chans: int | None = None, chs_info: List[Dict] | None = None, n_times: int | None = None, input_window_seconds: float | None = None, sfreq: float | None = None, add_log_softmax: bool | None = False)#
Mixin class for all EEG models in braindecode.
n_outputs (int) – Number of outputs of the model. This is the number of classes in the case of classification.
n_chans (int) – Number of EEG channels.
n_times (int) – Number of time samples of the input window.
input_window_seconds (float) – Length of the input window in seconds.
sfreq (float) – Sampling frequency of the EEG recordings.
add_log_softmax (bool) – Whether to use log-softmax non-linearity as the output function. LogSoftmax final layer will be removed in the future. Please adjust your loss function accordingly (e.g. CrossEntropyLoss)! Check the documentation of the torch.nn loss functions: https://pytorch.org/docs/stable/nn.html#loss-functions.
If some input signal-related parameters are not specified, there will be an attempt to infer them from the other parameters.
- get_output_shape() Tuple[int] #
Returns shape of neural network output for batch size equal 1.
output_shape – shape of the network output for batch_size==1 (1, …)
- Return type:
- get_torchinfo_statistics(col_names: Iterable[str] | None = ('input_size', 'output_size', 'num_params', 'kernel_size'), row_settings: Iterable[str] | None = ('var_names', 'depth')) ModelStatistics #
Generate table describing the model using torchinfo.summary.
col_names (tuple, optional) – Specify which columns to show in the output, see torchinfo for details, by default (“input_size”, “output_size”, “num_params”, “kernel_size”)
row_settings (tuple, optional) – Specify which features to show in a row, see torchinfo for details, by default (“var_names”, “depth”)
ModelStatistics generated by torchinfo.summary.
- Return type:
- load_state_dict(state_dict, *args, **kwargs)#
- to_dense_prediction_model(axis: Tuple[int] = (2, 3)) None #
Transform a sequential model with strides to a model that outputs dense predictions by removing the strides and instead inserting dilations. Modifies model in-place.
Does not yet work correctly for average pooling. Prior to version 0.1.7, there had been a bug that could move strides backwards one layer.