JAABA Features

TODO: describe per-frame features

Per-frame features are computed from the input trajectories, and give information about the animal's state in the current frame. To classify behaviors, it also is necessary to provide contextual information about what the animal was doing in the frames before and after the current frame. For example, to detect whether an animal is walking, the speed in just the current frame is informative, but information about the speed in frames around the current frame, such as the mean or standard deviation of the speed in a window of frames around the current frame, can greatly improve performance. On top of the per-frame features, JAABA computes a large, fast, general-purpose set of window features to include this context.


Contents


Window Feature Types

Each window feature is computed from a window of frames for a single per-frame feature. At each frame, for each per-frame feature, we compute around 100-200 window features (depending on the per-frame feature and the JAABA settings). A window feature is defined by which per-frame feature it operates on, which window of frames it operates on (relative to the current frame), and what function it computes from this window of frames. Each window feature is thus defined by the following parameters:

The table below lists the type of window computations that are used in JAABA:

Type Description
mean Mean of the per-frame feature within the window.
min Minimum of the per-frame feature within the window.
max Maximum of the per-frame feature within the window.
std Standard deviation of the per-frame feature within the window.
hist This window feature requires as a parameter the edges of the histogram bins for the given per-frame feature. This actually corresponds to a group of window features, as, for each bin of the histogram, there is a separate window feature, which is the fraction of per-frame data within the current window which falls within the given bin.
harmonic Convolution of the data in the current window with a cosine function. This feature requires an extra parameter num_harmonic specifying the number of "bumps" within the filter (half the number of periods).
change Difference between the average value of the given per-frame feature in a small window at the end and the average value of a given per-frame feature in a small window at the start of the window. This feature requires an extra parameter change_window_radii specifying the radius of the smaller window.
diff_neighbor_mean Difference between the current frame's per-frame feature and the mean of the per-frame feature in the window.
diff_neighbor_min Difference between the current frame's per-frame feature and the minimum of the per-frame feature in the window.
diff_neighbor_max Difference between the current frame's per-frame feature and the maximum of the per-frame feature in the window.
zscore_neighbors Current frame's per-frame feature normalized by the mean and standard deviation of the per-frame feature in the window (subtract the mean then divide by the standard deviation).

Window Feature Transformations

For some per-frame features, we transform the features in some subset of the following ways:

For the absolute value and "flip" transformations, we do this by either taking the transformation of the per-frame data first, then computing the window function on the transformed data, or we do this by computing the window function first, then computing the transformation on the output of the window data. Whether we do the transformation first or not depends on the window feature.

We do the transformation first for the min, max, hist, diff_neighbor_min, diff_neighbor_max window feature types. We do the transformation after for the mean, prctile, change, harmonic, diff_neighbor_mean, and zscore_neighbors window feature types. We do not do the transformation for the std feature types.

For the relative transformation, we always do the transformation first.


Window Feature Templates

For each per-frame feature, we need to specify a large number of parameters to define which window features should be computed from it. We found that we almost always set these features in one of a few ways, and thus created templates for the parameters. Thus, for each per-frame feature, we specify a template as to which types of window features to compute.

The table below specifies the templates that we use.

Template Name Window Feature Types Used Window Radii Window Offsets Extra Parameters
Normal mean, min, max, change, std, harmonic, diff_neighbor_mean, diff_neighbor_min, diff_neighbor_max, zscore_neighbors 1, wradius/2, wradius 0, -1,1
  • mean: Window radii are instead 0, wradius/2 and wradius
  • change: The change small window radii are 1 and 3
  • harmonic: The number of harmonics ("bumps") is 3
More hist, mean, min, max, change, std, harmonic, diff_neighbor_mean, diff_neighbor_min, diff_neighbor_max, zscore_neighbors 1, wradius/2, wradius 0, -1,1
  • hist: Bin edges are chosen so that the number of bins is 5
  • mean: Window radii are instead 0, wradius/2 and wradius
  • change: The change small window radii are 1 and 3
  • harmonic: The number of harmonics ("bumps") is 1,2,3,4, and 5
Less mean, min, max, change, std, harmonic, diff_neighbor_mean, diff_neighbor_min, diff_neighbor_max, zscore_neighbors 1, wradius 0, -1,1
  • mean: Window radii are instead 0 and wradius
  • change: The change small window radii are 1 and 3
  • harmonic: The number of harmonics ("bumps") is 3

In the above table, wradius is a parameter specified by the user. It is roughly the radius of window size that the user thinks should be sufficient to capture the behavior.


Select Features

The Select Features dialog is a GUI the user can use to edit the window feature computation parameters for the current project. This interface can be accessed from the main JAABA window by selecting the menu item Classifier->Select Features.

Basic Mode

In basic mode, the user can select the classes of per-frame features and the window feature templates to be used for the class. The list of per-frame feature that belong to a particular class depends on the animal (Target-Type) that was selected for the project. Scores is a special class that has all the per-frame features that are the predictions of the previously trained classifiers. The list of per-frame features that belong to this particular class correspond to the list of the previously trained classifiers that were selected during project setup.


Screen capture of the Select Features dialog in Basic mode

Advanced Mode

In advanced mode, the user can set all the window feature parameters for each per-frame feature separately. The advanced mode also shows the histograms of the per-frame features over labeled data for all animals and unlabeled data for the currently selected animal. If the user changes any parameter for a per-frame feature then the window computation template for the corresponding class of per-frame features is set to custom.


Screen capture of the Select Features dialog in Advanced mode

Select Features Buttons