-
Notifications
You must be signed in to change notification settings - Fork 0
Decoder Class
Decoder class for converting offline or online neural data into behavioural data using methods provided.
class Decoder(ABC)Abstract base class for decoders. This class provides the common interface and functionality for all decoder implementations. It handles model instantiation, model loading, and defines the abstract methods.
Parameters:
-
cfg : dict
Configuration dictionary with the following structure, typically parsed by config parser:
decoder_struct = {'model': {'name': str, 'parameters': DictConfig, 'input_shape': ListConfig, 'output_shape': ListConfig}, 'stabilization': {'name': str, 'parameters': DictConfig, 'date_0': str, 'date_k': str}, 'fpath': str }
Attributes:
-
model : object
The instantiated model object
-
fpath : str
File path to saved model
-
input_shape : tuple
Expected input tensor dimensions
-
output_shape : tuple
Expected output tensor dimensions
Initialize the decoder with configuration, instantiates model, sets path to saved model, sets input and output shape, and loads the model.
Parameters:
-
cfg : dict
Config dictionary as described above
Load model parameters from file. Option to override the file path to the saved model.
Parameters:
-
fpath : str, optional
Path to model parameters. If None, uses the attribute fpath.
Create a deep copy of the decoder with loaded parameters.
Returns:
-
decoder : Decoder
Deep-copied decoder instance with parameters loaded from file
Predict outputs from neural data.
Parameters:
-
neural_data :
Input neural data
Returns:
-
predictions :
Decoded predictions
Get the expected input shape.
Returns:
-
shape : numpy.ndarray
Input dimensions
Get the expected output shape.
Returns:
-
shape : numpy.ndarray
Output dimensions