deepof.models.get_recurrent_encoder

deepof.models.get_recurrent_encoder(input_shape: tuple, edge_feature_shape: tuple, adjacency_matrix: ndarray, latent_dim: int, use_gnn: bool = True, gru_unroll: bool = False, bidirectional_merge: str = 'concat', interaction_regularization: float = 0.0)

Return a deep recurrent neural encoder.

Builds a neural network capable of encoding the motion tracking instances into a vector ready to be fed to

one of the provided structured latent spaces.

Parameters:
  • input_shape (tuple) – shape of the node features for the input data. Should be time x nodes x features.

  • edge_feature_shape (tuple) – shape of the adjacency matrix to use in the graph attention layers. Should be time x edges x features.

  • adjacency_matrix (np.ndarray) – adjacency matrix for the mice connectivity graph. Shape should be nodes x nodes.

  • latent_dim (int) – dimension of the latent space.

  • use_gnn (bool) – If True, the encoder uses a graph representation of the input, with coordinates and speeds as node attributes, and distances as edge attributes. If False, a regular 3D tensor is used as input.

  • gru_unroll (bool) – whether to unroll the GRU layers. Defaults to False.

  • bidirectional_merge (str) – how to merge the forward and backward GRU layers. Defaults to “concat”.

  • interaction_regularization (float) – Regularization parameter for the interaction features.

Returns:

a keras model that can be trained to encode motion tracking instances into a vector.

Return type:

keras.Model