Skip to content

Dtw finch

The bout path to a behavior vocabulary. It cuts each subject's trajectory into bouts at the moments the pose changes, compares every pair of bouts, and groups the ones that resemble each other. A cluster is a kind of bout, and every bout is an instance with a real start and end.

Bouts first. A sliding Window pools the per-frame embedding to smooth out jitter, and the Detector places the cuts: binseg by default, which cut better than novelty in internal measurements. Bouts shorter than Min bout length are dropped before anything is compared, so this method needs no separate minimum-run floor. A break in tracking longer than Max tracking gap is a boundary, never the inside of a bout.

Compared with a warp tolerance. Each pair of bouts is compared by dynamic time warping, and DTW band sets how far one may be stretched against the other. That is what lets a slow and a fast performance of the same behavior match. A wider band merges more bouts into fewer, coarser clusters.

Grouped without a target count. FINCH links each bout to its single nearest neighbour, takes the connected groups, and repeats on the groups. The tree that comes out is the data's, not a number anyone chose, and you label its nodes afterwards.

The comparison is the cost, and it grows with the square of the bout count. A long study has many bouts, so a fit over one is slow. Max bouts bounds it by evenly sampling the bouts the comparison sees; every other bout is then matched to the nearest cluster, so a cap changes what the vocabulary is learned from, not what gets labelled. The interpretation screen says when a fit was capped. For a long study, codebook_viterbi keeps the cost in proportion instead.

What you get for it. Measured against the codebook it ties on vocabulary quality and draws slightly better boundaries.

Parameters

Window

window_s · number · default 0.53 · range ≥ 0 · unit s

Sliding-window length (seconds) the pose trajectory is pooled over before segmentation, which smooths per-frame jitter. About 0.53 s is the tuned 8-frame window at a 15 fps embed rate; the rows it resolves to depend on your embed cadence.

Window pooling

pool · string · default mean

How each window is pooled into one feature: mean (average pose), max (per-dimension peak, so a brief distinctive pose is not averaged away) or flatten (concatenate the frames).

Window stride

feat_stride · integer · default 1 · range ≥ 1

Step (embedded frames) between successive window positions. Raise it to subsample windows, which is coarser and faster.

Detector

detector · string · default binseg

Transition detector that cuts the trajectory into bouts. binseg is the default on measurement: it cuts better than novelty at the same rule and vocabulary size. novelty is a windowed cosine discrepancy, speed takes cosine-step peaks, and abd deliberately over-cuts for a rule that merges the pieces back.

binseg penalty

penalty · number · default 40.0 · range ≥ 0

binseg stop threshold. Lower cuts more, giving more and shorter bouts.

Peak percentile

percentile · number · default 96.0 · range 0–100

novelty/speed peak threshold percentile. Lower cuts more.

Novelty window

novelty_half_s · number · default 0.14 · range > 0 · unit s

novelty comparison window half-width, in seconds.

abd smoothing

abd_smooth_half_s · number · default 0.034 · range ≥ 0 · unit s

abd: how long either side is averaged before looking for a change. Keep it small, because smoothing wider than the pose's own correlation length blurs away the transitions it is meant to sharpen.

abd spacing

abd_nms_window_s · number · default 0.085 · range > 0 · unit s

abd: how far apart in time two cuts must be. A cut survives only if it is the strongest change within this long either side.

Min cut spacing

min_size_s · number · default 0.1 · range > 0 · unit s

Minimum time between successive cuts, in seconds, for every detector.

Max tracking gap

max_gap_s · number · range > 0 · unit s

Break the trajectory into continuous runs wherever tracking is missing for longer than this. Omit to derive it from the embed cadence, which is what makes a tracking gap a boundary rather than a bout that spans one.

Min bout length

min_len_s · number · default 0.27 · range ≥ 0 · unit s

Drop bouts shorter than this (seconds) before clustering. This is why the method needs no separate minimum-run floor the way a frame-labeling method does: a bout is already an extent, and one too short to be a behavior never reaches the comparison. About 0.27 s is the tuned 4-frame minimum at a 15 fps embed rate.

DTW band

band_s · number · default 0.27 · range ≥ 0 · unit s

DTW warp tolerance when comparing bouts (seconds; 0 = rigid). This is what lets a slow and a fast performance of the same behavior match. Larger merges more bouts into fewer, coarser clusters.

Max bouts

max_segments · integer · range ≥ 2

Cap the bouts compared against each other, evenly subsampled. The DTW comparison is O(bouts²) and is the whole cost of a fit, so this is the only bound on it. A capped fit is stated on the interpretation screen, because it is identical to a full one in every other respect. Omit to compare every bout.