7d7cc56Add overlap pursuit classifier and update composerJeremy Magland 1/** The shipped classifier sources and the starting point for a custom one. */
b11b069Classify takes with numbl algorithms by default (silence_gap_knn from audio-spike-sorting, noise-floor adapted), with a custom-algorithm editor and the feature kNN kept as an optionJeremy Magland 2import silenceGapKnnSrc from './silence_gap_knn.m?raw';
7d7cc56Add overlap pursuit classifier and update composerJeremy Magland 3import overlapPursuitSrc from './overlap_pursuit.m?raw';
b11b069Classify takes with numbl algorithms by default (silence_gap_knn from audio-spike-sorting, noise-floor adapted), with a custom-algorithm editor and the feature kNN kept as an optionJeremy Magland 4
7d7cc56Add overlap pursuit classifier and update composerJeremy Magland 5/** The built-in numbl classifiers, keyed by their ClassifierState method
6 * value. silence_gap_knn is the default; overlap_pursuit adds matching
7 * pursuit over merged regions for takes with overlapping hits. */
8export const BUILTIN_CLASSIFIERS = {
9 builtin: { name: 'silence_gap_knn', source: silenceGapKnnSrc },
10 pursuit: { name: 'overlap_pursuit', source: overlapPursuitSrc },
11} as const;
12export type BuiltinMethod = keyof typeof BUILTIN_CLASSIFIERS;
14export const DEFAULT_CLASSIFIER_NAME = BUILTIN_CLASSIFIERS.builtin.name;
15export const DEFAULT_CLASSIFIER_SOURCE = BUILTIN_CLASSIFIERS.builtin.source;
b11b069Classify takes with numbl algorithms by default (silence_gap_knn from audio-spike-sorting, noise-floor adapted), with a custom-algorithm editor and the feature kNN kept as an optionJeremy Magland 16
17export const CUSTOM_CLASSIFIER_TEMPLATE = `function [times, labels] = my_classifier(x, fs, training)
18% x the take, column vector at fs Hz (16 kHz)
19% training struct: snips {1 x nVoices} cell of [snipLen x nSnips]
20% matrices (columns are training snippets), names {1 x nVoices},
21% pre (samples before the hit onset within each snippet)
22% Return column vectors: hit times in seconds and 1-based voice indices.
23% The same interface as the audio-spike-sorting benchmark, so an
24% algorithm developed there drops in here unchanged.
25times = zeros(0, 1);
26labels = zeros(0, 1);
27end
28`;