Build your own Scikit-NeuroMSI model
You can implement your own model by importing the SKNMSIMethodABC method from the core module and creating a class calling such method.
Such class must have four attributes to define the model’s identity and input/output modalities:
_model_name: Name of the model._model_type: Classification of the model (e.g. MLE, Bayesian, Neural, etc)._run_input: Modality specific parameters computed by the model._run_output: Modality specific results delivered by the model.
Furthermore, the class must have six managed attributes (properties) defined in the init method:
mode0: Name of sensory modality 0.mode1: Name of sensory modality 1.position_range: Range of positions encoded by the model.position_res: Resolution of positional encoding.time_range: Range of times encoded by the model.time_res: Resolution of time encoding.
The model may include more than two sensory modalities, as long as they are properly defined in the class.
Finally, the class must have two methods to specify the model execution:
set_random: Sets random seed (if required).run: Executes the model
Here a template of a Scikit-NeuroMSI model class:
[1]:
from skneuromsi.core import SKNMSIMethodABC
class MyBayesianModel(SKNMSIMethodABC):
_model_name = "MyBayesianModel"
_model_type = "Bayesian"
_output_mode = "multi"
_run_input = [
{"target": "auditory_position", "template": "${mode0}_position"},
{"target": "visual_position", "template": "${mode1}_position"},
]
_run_output = [
{"target": "auditory", "template": "${mode0}"},
{"target": "visual", "template": "${mode1}"},
]
def __init__(
self,
*,
mode0="auditory",
mode1="visual",
position_range=(0, 29),
position_res=1,
time_range=(1, 2),
time_res=1,
):
self._mode0 = mode0
self._mode1 = mode1
self._position_range = position_range
self._position_res = float(position_res)
self._time_range = time_range
self._time_res = float(time_res)
# PROPERTY ================================================================
@property
def mode0(self):
return self._mode0
@property
def mode1(self):
return self._mode1
@property
def time_range(self):
return self._time_range
@property
def time_res(self):
return self._time_res
@property
def position_range(self):
return self._position_range
@property
def position_res(self):
return self._position_res
# MODEL RUN ================================================================
def set_random():
pass
def run(auditory_position, visual_position): ...
For more details about model building, please refer to the API documentation.