-
Notifications
You must be signed in to change notification settings - Fork 1
Run Modes
A run configuration is set by a list of dictionaries, each dictionary corresponding to a trial.
Handing of these options is done in the TrialManager class.
See example run configurations in configuration_examples.py file.
There are four options for Run Mode:
- Training – To Train agents
- Assay – Normal assay mode
- Split-Assay – On incidence of a specified event in normal assay mode, run the remainder of the episode with and without a specified modification.
- Assay-Analysis-Across-Scaffold – Run specified assays, then apply an analysis script to the data generated, for saved checkpoints at each scaffold point.
Basic options (to specify Training mode):
- "Model Name": "example_name",
- "Environment Name": "example_parameters",
- "Trial Number": 1,
- "Run Mode": "Training",
- "Learning Algorithm": "DQN", (or PPO)
Optional parameters:
- "Using GPU": False, (default True)
All assay modes handled by AssayService, as well as PPOAssayService and DQNAssayService.
- "Model Name": "example_name",
- "Environment Name": "example_parameters",
- "Trial Number": 1,
- "Learning Algorithm": "DQN",
- "Run Mode": "Assay",
- "Assay Configuration Name": "Behavioural-Data-Free", (The name of the .h5 file to which data is saved)
- "behavioural recordings": ["environmental positions"], (will record everything in the environment, as well as naturally recording fish actions, observations etc. Naturally. Legacy from when disk space was more of a concern – had more options)
- "network recordings": ["rnn_shared", "internal_state"], (the names of the network layers to record) NOTE: Not set up to record layers besides these two since change from dynamic base network.
- "Assays": [
- {
- "assay id": "Naturalistic", (name of .h5 group for each trial – concatenated with repeat index)
- "repeats": 40, (Number of trials to run)
- "stimulus paradigm": "Naturalistic", (Free swimming/naturalistic trial, as in training, or Projection – see below)
- "duration": 10000, (max duration of each trial in steps)
- "tethered": False, (whether fish actions have effect, see below)
- "save frames": False, _(autogenerate video at end of each episode) _
- "use_mu": True, (PPO only, use the mean values outputted by networks, rather than sampling from distributions)
- },
- ]
Optional parameters:
- "Checkpoint": 67, (specify a particular checkpoint number to load from)
- "set random seed": False, (if True, remove randomness from trial)
Parameters in addition to base assay mode:
- "Run Mode": "Split-Assay",
- "Split Event": "One-Prey-Close",
- "Modification": "Nearby-Prey-Removal",
Parameters in addition to base assay mode:
- "Run Mode": "Assay-Analysis-Across-Scaffold",
- "Config Modification": "Empty", (False/None will lead to just using the configuration at that scaffold point. Empty will remove all environmental features from the config – here is useful for turn analysis)
- "Delete Data": True, (autodelete data after analysis scripts have been run)
- "Analysis": [
- {
- "analysis id": "Turn-Analysis",
- "analysis script": "Analysis.Behavioural.Exploration.turning_analysis_discrete", (location of analysis file)
- "analysis function": "plot_all_turn_analysis", (name of method to run)
- "analysis arguments": ["model_name", "assay_config_name", "Naturalistic", 10], (Arguments for analysis function. If these match any of the locals(), they will be set to the value of the locals – e.g. here, model_name is a variable already)
- }
- ]
All the following options are available in each assay mode.
In any mode, set "tethered": True to stop the actions of the fish having any effect on its positioning.
Complements controlled stimulus mode below.
In any mode, set “stimulus paradigm”: “Projection”, to allow control of environmental features directly.
Additional parameters for each Assay dictionary:
"stimulus paradigm": "Projection",
"random positions": False, (in controlled stimulus mode, is the option to have randomly appearing stimuil)
"reset": False, (option to restart the network trajectory after each presentation)
"moving": False, (whether specified stimuli move. Can be False, Left, Right, Towards, Away)
"reset interval": 100,
"duration": 950,
There are 8 types of programmed interventions:
Visual – Set the observation to spatially and temporally uniform mean values for each channel. Note will need to recalibrate the mean values for this.
Energy state – Set the energy state to a specified trace.
Efference copy – Set efference copy to specified trace.
In light – For the in_light energy state (1 when in well lit region, 0 otherwise).
Salt – Set salt concentration input to specified state.
Fish position – Can relocate the fish at specific time points.
Ablations – Set a particular layers weights to a provided matrix e.g. with specific units zeroed.
RNN input – Set initial RNN state to a specific set of values.
The first 6 are set separately each step, through provided timeseries.
.h5 files are organised by groups. Each group corresponds to an episode of data.
Each group contains multiple datasets, each an array of values recorded of a particular feature of the simulation/network. E.g. the “observation” dataset contains the observation received by the agent at each step of an episode.
Use Analysis.load_data.py load_data function to get all the datasets for a group returned as a dictionary.
Jagged array solution detail for prey positions etc.