Skip to content

agglomerative

agglomerative(data, k, options?): Uint32Array<ArrayBufferLike>

Defined in: packages/pleco-xa/src/segment/index.js:559

Bottom-up temporal segmentation: partition frames into k contiguous segments by temporally-constrained agglomerative clustering. Mirrors sklearn’s AgglomerativeClustering with Ward linkage on a chain connectivity graph: repeatedly merge the ADJACENT pair of segments with minimum Ward increment d²(A, B) = (nA·nB / (nA + nB)) · ||centroid(A) − centroid(B)||² until k segments remain.

any[] | Float32Array<ArrayBufferLike> | Float64Array<ArrayBufferLike>

features, shape (d, n) 2D, or flat with explicit options.nFeatures/options.nFrames.

number

number of segments (1 <= k <= n_frames).

any = {}

{ nFeatures, nFrames } for flat input.

Uint32Array<ArrayBufferLike>

left-boundary frame indices (always starts with 0).