Skip to main content

Project Configuration

The project configuration YAML file exists in the root of the project folder and holds the main parameters for the VAME workflow. The configuration file is created when initializing a new project with the init_new_project function, and some values are updated by later steps.

Some fields are kept so older projects still load, but are not read by the current code. They are marked as not used below.

Project parameters​

FieldTypeDefaultDescription
vame_versionstrVAME version that created the project.
project_namestrName of the project.
project_pathstrPath to the project folder.
creation_datetimestrCreation time of the project, in UTC (ISO 8601).
session_namesList[str]Names of the sessions in the project, one per pose estimation file.
pose_estimation_filetypestrFile type of the input pose estimation files: csv, nwb, slp, h5 or nc.
video_typeOptional[str]NoneExtension of the project's raw videos (.mp4 or .avi), recorded when they are loaded. None when the project has no videos or mixes formats; each session's video is resolved from data/raw either way.
project_random_stateint42Seed for model training, the train/test split, k-means, HMM and UMAP.

Data and preprocessing​

FieldTypeDefaultDescription
all_datastr"yes"When "yes", segmentation, community analysis and video functions run on all sessions. Otherwise they ask which sessions to use.
keypointsOptional[List[str]]NoneNames of the keypoints in the pose estimation data.
extra_featuresList[str][]Names of pre-computed scalar features stored in each session's processed .nc file and appended to the model input. Written with vame.io.add_extra_features.
preprocessed_variablestr"position_processed"Output variable of the last preprocessing step. Set by vame.preprocessing, and read by create_trainset by default.
pose_confidencefloat0.99Confidence threshold for low-confidence cleaning. Points below it are cleared and interpolated.
robustboolTrueWhen false, outlier cleaning leaves the data unchanged.
iqr_factorint4Outlier cleaning removes points whose z-score is more than iqr_factor times the IQR.
savgol_lengthint5Window length of the Savitzky-Golay filter.
savgol_orderint2Polynomial order of the Savitzky-Golay filter.
test_fractionfloat0.1Fraction of the data held out for testing, used when create_trainset is called with test_fraction=None.
egocentric_databoolFalseWhether the data is egocentric from the start, as with head-fixed animals. Only read by vame.pose_to_numpy, which requires it to be true.
savgol_filterboolTrueNot used. Pass run_savgol_filtering to vame.preprocessing instead.

RNN model general hyperparameters​

FieldTypeDefaultDescription
model_namestr"VAME"Name of the model, used in model and results file paths.
pretrained_modelstr"None"Model to start training from when pretrained_weights is true: the name of a model in this project, or a path to a weights file.
pretrained_weightsboolFalseWhether training starts from the weights of pretrained_model. KL annealing is skipped in that case.
num_featuresint12Number of input features per frame. Set when the project and the training set are created.
batch_sizeint256Training batch size. The test batch size is a quarter of it.
max_epochsint500Maximum number of training epochs.
model_snapshotint50Save a snapshot of the model every this many epochs.
model_convergenceint50Stop training after this many epochs without improvement of the test loss.
betafloat1Weight of the KL divergence loss.
zdimsint30Number of latent dimensions.
learning_ratefloat5e-4Learning rate of the Adam optimizer.
time_windowint30Number of frames in each input window.
prediction_decoderint1Whether the model has a decoder that predicts the frames after each window (1) or not (0).
prediction_stepsint15Number of future frames the prediction decoder predicts.
noiseboolFalseWhether Gaussian noise is added to the training inputs.
schedulerint11 reduces the learning rate when the test loss stops improving (ReduceLROnPlateau). 0 keeps it constant.
scheduler_step_sizeint100Epochs without improvement before the learning rate is reduced.
scheduler_gammafloat0.2Factor the learning rate is multiplied by when it is reduced.
softplusboolFalseWhether a softplus activation is applied to the encoder's log-variance output.
steps_per_epochOptional[int]NoneNumber of batches per epoch. None draws one sample per frame, so epoch length grows with the data.
transition_functionstr"GRU"Not used. The model always uses GRUs.
beta_normboolFalseNot used.
scheduler_thresholdOptional[float]NoneNot used. The scheduler uses a relative threshold of 1e-3.

Segmentation​

FieldTypeDefaultDescription
n_clustersint15Number of motifs.
segmentation_algorithmsList[str]["hmm", "kmeans"]Algorithms used to segment the latent space into motifs.
hmm_trainedboolFalseWhen true, segmentation loads the HMM saved in results/hmm_trained.pkl instead of fitting a new one.
hmm_n_iterint100Maximum number of iterations when fitting the HMM.
kmeans_n_initint20Number of times k-means is run with different centroid seeds. The run with the lowest inertia is kept. Lower values make k-means faster on large datasets.
kmeans_fit_samplesOptional[int]NoneNumber of frames, sampled at random with project_random_state, that k-means is fit on. Every frame is then assigned to its nearest cluster center. None fits on all frames.

Video writer​

FieldTypeDefaultDescription
length_of_motif_videoint1000Maximum number of frames in each motif video.

UMAP parameters​

FieldTypeDefaultDescription
min_distfloat0.1UMAP min_dist.
n_neighborsint200UMAP n_neighbors.
num_pointsint30000Number of points used for the UMAP embedding in vame.gif.

RNN encoder hyperparameters​

FieldTypeDefaultDescription
hidden_size_layer_1int256Hidden size of the encoder GRU.
hidden_size_layer_2int256Not used.
dropout_encoderfloat0Dropout in the encoder.

RNN reconstruction hyperparameters​

FieldTypeDefaultDescription
hidden_size_recint256Hidden size of the reconstruction decoder GRU.
dropout_recfloat0Dropout in the reconstruction decoder.
n_layersint1Not used. The number of GRU layers is fixed in the model.

RNN prediction hyperparameters​

FieldTypeDefaultDescription
hidden_size_predint256Hidden size of the prediction decoder GRU.
dropout_predfloat0Dropout in the prediction decoder.

RNN loss hyperparameters​

FieldTypeDefaultDescription
mse_reconstruction_reductionstr"sum"Reduction of the reconstruction MSE loss ("sum" or "mean").
mse_prediction_reductionstr"sum"Reduction of the prediction MSE loss ("sum" or "mean").
kmeans_lossint30Number of singular values of the latent Gram matrix summed in the k-means loss.
kmeans_lambdafloat0.1Weight of the k-means loss.
anneal_functionstr"linear"Shape of the KL annealing schedule: "linear" or "sigmoid".
kl_startint2Epoch at which the KL and k-means losses start to be added.
annealtimeint4With "linear", the number of epochs over which the KL weight ramps up to 1. With "sigmoid", the epoch at the middle of the ramp.