nnsa.feature_extraction.brainagemodel.core package

Submodules

nnsa.feature_extraction.brainagemodel.core.config module

Classes:

Config(**kwargs)

class nnsa.feature_extraction.brainagemodel.core.config.Config(**kwargs)[source]

Bases: object

Methods:

assign(**kwargs)

copy([deep])

copy the item, deep or shallow

items()

join(obj[, key_prefix])

This function takes two objects (or self, obj) and join the parameters into the first one (self). It raises an error if there is a conflict in the keys. key_prefix: if is not none, it will be added to the keys of the obj. e.g. obj.p (given key_prefix='blabla_') -> self.blabla_p = obj.p.

keys()

assign(**kwargs)[source]
copy(deep: bool = True)[source]

copy the item, deep or shallow

items()[source]
join(obj, key_prefix: str | None = None)[source]

This function takes two objects (or self, obj) and join the parameters into the first one (self). It raises an error if there is a conflict in the keys. key_prefix: if is not none, it will be added to the keys of the obj.

e.g. obj.p (given key_prefix=’blabla_’) -> self.blabla_p = obj.p

keys()[source]

nnsa.feature_extraction.brainagemodel.core.ensemblemodels module

Classes:

EnsembleModels(CH, trained_model_directory)

To load all ensembled Sinc models.

class nnsa.feature_extraction.brainagemodel.core.ensemblemodels.EnsembleModels(CH, trained_model_directory, verbose=True)[source]

Bases: object

To load all ensembled Sinc models. Note that it is not a keras model, but it has a predict funtion with similar inputs/outputs.

Parameters:

CH: the number of eeg channels {1, 2, 4, or 8} trained_model_directory: the directory in which the ensemble models are located. The name of the models must be ‘model[x].h5’ (e.g. model1.h5, model2.h5, …). It maximally supports 1000 models. verbose: if True, it shows the loading progress; otherwise, it is silent.

Methods:

aggregate(pmas, recordings_indices)

This function takes pmas tensor of all recordings and all models as well as the recording indices/names and returns the aggregated PMA per recording in a dictionary.

predict(eeg)

To predict the outputs of all loaded ensembled models.

aggregate(pmas, recordings_indices)[source]

This function takes pmas tensor of all recordings and all models as well as the recording indices/names and returns the aggregated PMA per recording in a dictionary. This can be called after the ‘predict’ function. The ‘predict_recording’ function internally calls this function and returns its output.

predict(eeg)[source]

To predict the outputs of all loaded ensembled models.

parameters:

eeg: a numpy tensor as [batch, 1920, CH]

OR a datagenerator returning [batch, 1920, CH]

Return:

PMA numpy matrix as [batch, number of models]

Module contents