deepof.post_hoc.annotate_time_chunks

deepof.post_hoc.annotate_time_chunks(deepof_project: deepof_coordinates, soft_counts: deepof_table_dict, breaks: deepof_table_dict, supervised_annotations: deepof_table_dict | None = None, window_size: int | None = None, window_step: int = 1, animal_id: str | None = None, samples: int = 10000, min_confidence: float = 0.0, kin_derivative: int = 1, include_distances: bool = True, include_angles: bool = True, include_areas: bool = True, aggregate: str = 'mean')

Annotate time chunks produced after change-point detection using the unsupervised pipeline.

Uses a set of summary statistics coming from kinematics, distances, angles, and supervised labels when provided.

Parameters:
  • deepof_project (coordinates) – Project object.

  • soft_counts (table_dict) – matrix with soft cluster assignments produced by the unsupervised pipeline.

  • breaks (table_dict) – the breaks for each condition.

  • supervised_annotations (table_dict) – set of supervised annotations produced by the supervised pipeline withing deepof.

  • window_size (int) – Minimum size of the applied ruptures. If automatic_changepoints is False, specifies the size of the sliding window to pass through the data to generate training instances. None defaults to video frame-rate.

  • window_step (int) – Specifies the minimum jump for the rupture algorithms. If automatic_changepoints is False, specifies the step to take when sliding the aforementioned window. In this case, a value of 1 indicates a true sliding window, and a value equal to window_size splits the data into non-overlapping chunks.

  • animal_id (str) – The animal ID to use, in case of multi-animal projects.

  • samples (int) – Time chunks samples to take to reduce computational time. Defaults to the minimum between 10000 and the number of available chunks.

  • min_confidence (float) – minimum confidence in cluster assignments used for quality control filtering.

  • kin_derivative (int) – The order of the derivative to use for the kinematics. 1 = speed, 2 = acceleration, etc.

  • include_distances (bool) – Whether to include distances in the alignment. kin_derivative is taken into account.

  • include_angles (bool) – Whether to include angles in the alignment. kin_derivative is taken into account.

  • include_areas (bool) – Whether to include areas in the alignment. kin_derivative is taken into account.

  • aggregate (str) – aggregation mode. Can be either “mean” (computationally cheapest), just use the average per feature, or “seglearn” which runs a thorough feature extraction and selection pipeline on each time series.

Returns:

A dataframe of kinematic features, of shape chunks by features.