Menu

Deep learning for NeuroImaging in Python.

Note

This page is a reference documentation. It only explains the function signature, and not how to use it. Please refer to the gallery for the big picture.

nidl.experiment.fetch_experiment(expfile: str, selector: tuple[str] | None = None, cv: tuple[str] | None = None, logdir: str | None = None, verbose: int = 0)[source]

Fetch an experiement from an input configuration file.

Allowed keys are:

  • project: define here some usefull information about your experiment such as the ‘name’, ‘author’, ‘date’…

  • global: define here global variables that can be reused in other sections.

  • import: define here import that can be reused in other sections with the ‘auto’ mode (see desciption below).

  • scaler: dl interface

  • transform: dl interfaces

  • compose: dl interfaces

  • augmentation: dl interface

  • dataset: dl interface

  • dataloader: dl interface

  • model: dl interface

  • weights: dl interface

  • loss: dl interface

  • optimizer: dl interface

  • scheduler: dl interface

  • probe: dl interface

  • training: define here training settings.

  • environements: define here the interface to load in order to fullfil your needs and the constraint impose by the ‘interface_occurrences’ parameter (see desciption below).

Interface definition:

  • the ‘interface’ key contains a name that specifies what class to import in absolute terms.

  • the ‘interface_version’ key contains the expected version of the loaded interface. The ‘__version__’ module parameter is checked if available and a warning is displayed if is mismatched is detected or the version connot be checked.

  • other key are the interface parameters.

  • dynamic parameters can be defined by specifying where this parameter can be find a previously loaded interface, i.e., ‘auto|<name>.<param>’. Note that the order is important here.

  • cross validation can be defined by specifying a list of values, i.e. ‘cv|[1, 2, 3]’. This will automatically instanciate multiple interface, one for each input setting.

The codes works as follows:

  • multiple interfaces of the same type can be returned.

  • the different choices must be described in an ‘environments’ section.

  • the output name will be prefixed by the environment name.

  • use the selector input parameters to filter the available interfaces in the input configuration file.

How to define multiple building blocks:

  • the construction is hierarchic, i.e. child building blocks inherit the properties of the parent building block.

  • a child building block name contains the parent name as a prefix and use the ‘.’ separator.

The weights section special case:

  • model names specified in the form hf-hub:path/architecture_name@revision will be loaded from Hugging Face hub.

  • model names specifid with a path will be loaded from the local machine.

Parameters:

expfile : str

the experimental design file.

selector : tuple of str, default=None

if multiple interface of the same type are defined, this parameter allows you to select the appropriate environements.

cv : tuple of str, default=None

if a cross validation scheme is defined, this parameter allows you to select only some interfaces (i.e., the best set of hyperparapeters).

logdir : str, defautl=None

allows you to save a couple of information about the loaded interface: for the moment only the source code of each interface.

verbose : int, default=0

enable verbose output.

Returns:

data : Bunch

dictionaray-like object containing the experiment building blocks.

Follow us

© 2025, nidl developers