ainest312 Simonlob commited on
Commit
8fdab04
·
0 Parent(s):

Duplicate from aiacademy-kg/kws-dataset

Browse files

Co-authored-by: Den Pavloff <Simonlob@users.noreply.huggingface.co>

Files changed (3) hide show
  1. .gitattributes +60 -0
  2. README.md +465 -0
  3. data/train-00000-of-00001.parquet +3 -0
.gitattributes ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ *.7z filter=lfs diff=lfs merge=lfs -text
2
+ *.arrow filter=lfs diff=lfs merge=lfs -text
3
+ *.avro filter=lfs diff=lfs merge=lfs -text
4
+ *.bin filter=lfs diff=lfs merge=lfs -text
5
+ *.bz2 filter=lfs diff=lfs merge=lfs -text
6
+ *.ckpt filter=lfs diff=lfs merge=lfs -text
7
+ *.ftz filter=lfs diff=lfs merge=lfs -text
8
+ *.gz filter=lfs diff=lfs merge=lfs -text
9
+ *.h5 filter=lfs diff=lfs merge=lfs -text
10
+ *.joblib filter=lfs diff=lfs merge=lfs -text
11
+ *.lfs.* filter=lfs diff=lfs merge=lfs -text
12
+ *.lz4 filter=lfs diff=lfs merge=lfs -text
13
+ *.mds filter=lfs diff=lfs merge=lfs -text
14
+ *.mlmodel filter=lfs diff=lfs merge=lfs -text
15
+ *.model filter=lfs diff=lfs merge=lfs -text
16
+ *.msgpack filter=lfs diff=lfs merge=lfs -text
17
+ *.npy filter=lfs diff=lfs merge=lfs -text
18
+ *.npz filter=lfs diff=lfs merge=lfs -text
19
+ *.onnx filter=lfs diff=lfs merge=lfs -text
20
+ *.ot filter=lfs diff=lfs merge=lfs -text
21
+ *.parquet filter=lfs diff=lfs merge=lfs -text
22
+ *.pb filter=lfs diff=lfs merge=lfs -text
23
+ *.pickle filter=lfs diff=lfs merge=lfs -text
24
+ *.pkl filter=lfs diff=lfs merge=lfs -text
25
+ *.pt filter=lfs diff=lfs merge=lfs -text
26
+ *.pth filter=lfs diff=lfs merge=lfs -text
27
+ *.rar filter=lfs diff=lfs merge=lfs -text
28
+ *.safetensors filter=lfs diff=lfs merge=lfs -text
29
+ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
30
+ *.tar.* filter=lfs diff=lfs merge=lfs -text
31
+ *.tar filter=lfs diff=lfs merge=lfs -text
32
+ *.tflite filter=lfs diff=lfs merge=lfs -text
33
+ *.tgz filter=lfs diff=lfs merge=lfs -text
34
+ *.wasm filter=lfs diff=lfs merge=lfs -text
35
+ *.xz filter=lfs diff=lfs merge=lfs -text
36
+ *.zip filter=lfs diff=lfs merge=lfs -text
37
+ *.zst filter=lfs diff=lfs merge=lfs -text
38
+ *tfevents* filter=lfs diff=lfs merge=lfs -text
39
+ # Audio files - uncompressed
40
+ *.pcm filter=lfs diff=lfs merge=lfs -text
41
+ *.sam filter=lfs diff=lfs merge=lfs -text
42
+ *.raw filter=lfs diff=lfs merge=lfs -text
43
+ # Audio files - compressed
44
+ *.aac filter=lfs diff=lfs merge=lfs -text
45
+ *.flac filter=lfs diff=lfs merge=lfs -text
46
+ *.mp3 filter=lfs diff=lfs merge=lfs -text
47
+ *.ogg filter=lfs diff=lfs merge=lfs -text
48
+ *.wav filter=lfs diff=lfs merge=lfs -text
49
+ # Image files - uncompressed
50
+ *.bmp filter=lfs diff=lfs merge=lfs -text
51
+ *.gif filter=lfs diff=lfs merge=lfs -text
52
+ *.png filter=lfs diff=lfs merge=lfs -text
53
+ *.tiff filter=lfs diff=lfs merge=lfs -text
54
+ # Image files - compressed
55
+ *.jpg filter=lfs diff=lfs merge=lfs -text
56
+ *.jpeg filter=lfs diff=lfs merge=lfs -text
57
+ *.webp filter=lfs diff=lfs merge=lfs -text
58
+ # Video files - compressed
59
+ *.mp4 filter=lfs diff=lfs merge=lfs -text
60
+ *.webm filter=lfs diff=lfs merge=lfs -text
README.md ADDED
@@ -0,0 +1,465 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ language:
4
+ - ky
5
+ - ru
6
+ task_categories:
7
+ - tabular-classification
8
+ - audio-classification
9
+ tags:
10
+ - keyword-spotting
11
+ - wake-word
12
+ - kyrgyz
13
+ - speech
14
+ - mfcc
15
+ - spectral-features
16
+ - educational
17
+ - teaching
18
+ size_categories:
19
+ - 10K<n<100K
20
+ pretty_name: "Akylai KWS Features — Educational Spectral-Feature Dataset"
21
+ ---
22
+
23
+ # Akylai KWS Features — An Educational Spectral-Feature Dataset for Keyword Spotting
24
+
25
+ A ready-to-model, **tabular** dataset for teaching binary classification on a *real* speech
26
+ problem: detecting the Kyrgyz wake word **«Акылай»** (*Akylai*) versus everything else.
27
+ Each row is one short audio clip already converted into a **fixed-length vector of 250
28
+ spectral features**, so students can go straight to `scikit-learn` without touching a single
29
+ audio library — yet the problem is a genuine, non-toy **Keyword Spotting (KWS)** task with a
30
+ natural class imbalance, several distinct negative sub-populations, and instructive failure
31
+ modes.
32
+
33
+ > **One-line summary.** 40 000 clips → 250 acoustic features → binary label
34
+ > (`1` = wake word, `0` = not). Mildly imbalanced (1 : 3). Built for an ML course that has
35
+ > just covered linear models (Logistic Regression, SVM) and is about to meet trees.
36
+
37
+ ---
38
+
39
+ ## Table of contents
40
+
41
+ 1. [The task: what is Keyword Spotting?](#1-the-task-what-is-keyword-spotting)
42
+ 2. [A short history of wake words](#2-a-short-history-of-wake-words)
43
+ 3. [Where the audio comes from (provenance)](#3-where-the-audio-comes-from-provenance)
44
+ 4. [From a waveform to a feature vector](#4-from-a-waveform-to-a-feature-vector)
45
+ 5. [The features, in detail (with formulas)](#5-the-features-in-detail-with-formulas)
46
+ 6. [Temporal aggregation: variable-length audio → fixed vector](#6-temporal-aggregation-variable-length-audio--fixed-vector)
47
+ 7. [Dataset schema](#7-dataset-schema)
48
+ 8. [Modeling challenges (read this before you trust your accuracy)](#8-modeling-challenges)
49
+ 9. [License, provenance & citation](#9-license-provenance--citation)
50
+
51
+ ---
52
+
53
+ ## 1. The task: what is Keyword Spotting?
54
+
55
+ **Keyword Spotting (KWS)** is the problem of detecting a small set of predefined words or
56
+ short phrases in an audio stream. The most familiar special case is **wake-word detection**
57
+ (also *hotword* or *trigger-word* detection): a tiny, always-listening model that waits for a
58
+ single phrase — *"Hey Siri"*, *"OK Google"*, *"Alexa"* — and only then wakes up the heavy,
59
+ cloud-based speech recogniser.
60
+
61
+ Formally, given an audio segment $x(t)$ we want a decision function
62
+
63
+ $$
64
+ \hat{y} = \mathbb{1}\!\left[\, p(\text{keyword} \mid x) \ge \tau \,\right],
65
+ $$
66
+
67
+ where $\tau$ is an operating threshold. In this dataset the keyword is the Kyrgyz given name
68
+ **«Акылай»** (three syllables, stress on the final *-ай*), and the task is reduced to its
69
+ cleanest form: **binary classification of pre-segmented 2-second-scale clips** — keyword vs.
70
+ non-keyword.
71
+
72
+ KWS has several properties that make it a richer teaching example than tabular toy datasets:
73
+
74
+ - **Strong class imbalance.** In deployment the keyword is vanishingly rare (a wake word may
75
+ fire a handful of times per day against hours of non-keyword audio). Here we use a gentle
76
+ **1 : 3** ratio — enough to make *accuracy misleading* without being degenerate.
77
+ - **Asymmetric error costs.** A *false reject* (missing the keyword) annoys the user once; a
78
+ *false accept* (waking up on a TV advert) is far worse. This motivates the whole
79
+ precision/recall/threshold toolkit rather than a single accuracy number.
80
+ - **A meaningful feature-engineering step.** Audio is not naturally tabular. Turning a
81
+ waveform into a fixed-length vector is itself a modelling decision — and a great lesson.
82
+
83
+ ---
84
+
85
+ ## 2. A short history of wake words
86
+
87
+ - **1950s–60s — first isolated-word recognisers.** Bell Labs' *Audrey* (1952) recognised
88
+ spoken digits from a single speaker; IBM's *Shoebox* (1962) handled 16 words. These were
89
+ analog/template machines, but they established the core idea of matching short acoustic
90
+ patterns.
91
+ - **1970s–80s — features and dynamic time warping.** The **cepstrum** and then **Mel-Frequency
92
+ Cepstral Coefficients (MFCCs)** (Davis & Mermelstein, 1980) became the standard front-end,
93
+ and **DTW** allowed matching words of different durations.
94
+ - **1980s–2000s — statistical models.** **Hidden Markov Models (HMMs)** with Gaussian Mixture
95
+ emissions dominated speech. Classic KWS was often **keyword-filler HMMs**: one model for the
96
+ keyword, a "garbage" model for everything else.
97
+ - **2014 — the deep-learning turning point for KWS.** Google's *"Small-footprint keyword
98
+ spotting using deep neural networks"* (Chen, Parada & Heigold, 2014) showed a compact DNN on
99
+ log-mel features beating the HMM pipeline — the recipe behind *"OK Google"* on-device.
100
+ - **2014–2017 — the smart-speaker era.** *Amazon Echo / Alexa* (2014), *"Hey Siri"* on a
101
+ dedicated low-power core (2017), and *"OK Google"* turned always-on wake-word detection into
102
+ a mass-market component. Constraints became extreme: a few **tens of kilobytes** of
103
+ parameters, running continuously at milliwatts.
104
+ - **2018–present — convolutional & streaming models.** Architectures such as
105
+ **TC-ResNet**, **BC-ResNet**, and depthwise-separable CNNs pushed accuracy up while keeping
106
+ the model tiny enough for an MCU/NPU.
107
+
108
+ This dataset's parent project trains exactly such a tiny on-device model (a ~30 K-parameter
109
+ BC-ResNet) for «Акылай». **The features you have here are the *classical* front-end** —
110
+ MFCCs and spectral descriptors — which is both historically faithful and a perfect bridge
111
+ from "linear models on tables" to "real speech".
112
+
113
+ ---
114
+
115
+ ## 3. Where the audio comes from (provenance)
116
+
117
+ The clips come from **four different sources**, recorded in the `source` column. The single
118
+ most important thing to understand about this dataset is the split between **synthetic
119
+ (text-to-speech, TTS)** audio and **real human** audio.
120
+
121
+ | `source` | `label` | n | Synthetic / real | What it is |
122
+ |---|:---:|---:|---|---|
123
+ | `positive` | **1** | 10 000 | **TTS** (in-house Kyrgyz TTS) | The wake word **«Акылай»**, spoken by a Kyrgyz text-to-speech model trained on podcast voices. |
124
+ | `base_neg` | 0 | 7 680 | **TTS** (*same* engine as positives) | Other Kyrgyz words/phrases from the **same** TTS voice — *not* the wake word. |
125
+ | `confusable` | 0 | 2 949 | **TTS** (KaniTTS, a *different* engine) | Phonetic near-neighbours — words ending in *-ай / -лай / -кай / -бай* (e.g. *Алтынай, калай, чай, лайк*) designed to look "almost" like the keyword. |
126
+ | `podcast` | 0 | 19 371 | **Real human speech** | 2-second cuts of continuous Kyrgyz podcast speech — natural, spontaneous, with no wake word. |
127
+
128
+ **Why this matters (and why we keep `source`).** The negatives are not homogeneous:
129
+
130
+ - `podcast` is **real, out-of-domain** audio → in practice it is *easy* to separate from the
131
+ synthetic positives, partly for the wrong reason (the model can latch onto "synthetic vs.
132
+ real" timbre rather than the word itself — a classic **shortcut**).
133
+ - `base_neg` shares the **exact same TTS voice** as the positives, so the *only* thing
134
+ distinguishing it from a positive is the **word** → this is the **honest, hard** part of the
135
+ problem.
136
+ - `confusable` tests robustness to **phonetically similar words**.
137
+
138
+ The `source` column is **not a feature** — never feed it to the model. It is provided for
139
+ **error analysis**: *which kind of negative does your model actually fail on?* (Spoiler from
140
+ our baseline experiments: almost all false positives come from `base_neg`.)
141
+
142
+ > **Wake word.** «Акылай» — a Kyrgyz feminine given name, 3 syllables, stress on `-ай`.
143
+ > All audio is 16 kHz mono.
144
+
145
+ ---
146
+
147
+ ## 4. From a waveform to a feature vector
148
+
149
+ A raw clip is a sequence of $16\,000$ amplitude samples per second — far too high-dimensional
150
+ and variable-length to feed to a classifier directly. The standard speech front-end turns it
151
+ into a compact, fixed-length descriptor in three stages: **framing**, **time–frequency
152
+ transform**, and **feature extraction + aggregation**.
153
+
154
+ ### 4.1 Framing
155
+
156
+ The signal $x(n)$ is cut into overlapping short frames so that each frame is approximately
157
+ **stationary** (the vocal tract changes slowly, ~10 ms scale). We use
158
+
159
+ $$
160
+ N_{\text{fft}} = 512 \;(\approx 32\,\text{ms window}), \qquad H = 160 \;(\approx 10\,\text{ms hop}),
161
+ $$
162
+
163
+ with a **Hann window** $w(n) = 0.5\left(1 - \cos\frac{2\pi n}{N-1}\right)$ to reduce spectral
164
+ leakage.
165
+
166
+ ### 4.2 Short-Time Fourier Transform (STFT)
167
+
168
+ For frame index $m$ and frequency bin $k$,
169
+
170
+ $$
171
+ X(m,k) \;=\; \sum_{n=0}^{N_{\text{fft}}-1} x(n + mH)\, w(n)\, e^{-\,j\,2\pi k n / N_{\text{fft}}}.
172
+ $$
173
+
174
+ From it we form the **magnitude** $|X(m,k)|$ and **power** spectrogram
175
+
176
+ $$
177
+ S(m,k) = |X(m,k)|^2 .
178
+ $$
179
+
180
+ The bin $k$ corresponds to physical frequency $f_k = \dfrac{k}{N_{\text{fft}}}\, f_s$, with
181
+ $f_s = 16\,000$ Hz. Everything below is computed **per frame** $m$ and then aggregated over
182
+ time (§6).
183
+
184
+ ---
185
+
186
+ ## 5. The features, in detail (with formulas)
187
+
188
+ We extract **12 groups** of descriptors. They fall into three families:
189
+
190
+ - **Cepstral** (MFCC + dynamics) — compact model of the spectral *envelope* (the vocal-tract
191
+ shape that defines phonemes).
192
+ - **Spectral shape** (centroid, bandwidth, roll-off, flatness, contrast) — interpretable
193
+ scalar summaries of *where* and *how* spectral energy is distributed ("timbre").
194
+ - **Energy / harmonicity / time-domain** (RMS, chroma, ZCR) — loudness, pitch-class content,
195
+ and a rough voicing/noisiness cue.
196
+
197
+ ### 5.1 Mel filterbank and log-mel energies
198
+
199
+ Human pitch perception is roughly logarithmic, captured by the **mel scale**
200
+
201
+ $$
202
+ \text{mel}(f) = 2595 \,\log_{10}\!\left(1 + \frac{f}{700}\right).
203
+ $$
204
+
205
+ We place $M = 40$ overlapping **triangular filters** $H_j(k)$ equally spaced on the mel axis
206
+ and integrate the power spectrum through them:
207
+
208
+ $$
209
+ E_{\text{mel}}(m,j) \;=\; \sum_{k} H_j(k)\, S(m,k), \qquad j = 1,\dots,40 .
210
+ $$
211
+
212
+ The dataset stores the **log (dB) mel energies** $\;10\log_{10} E_{\text{mel}}(m,j)\;$
213
+ (columns `mel0…mel39`). *Interpretation:* a coarse, perceptually-warped picture of the spectral
214
+ envelope — high values in low-mel bands mean energy concentrated at low pitch, etc.
215
+
216
+ ### 5.2 Mel-Frequency Cepstral Coefficients (MFCC)
217
+
218
+ MFCCs decorrelate the log-mel vector with a **Discrete Cosine Transform (DCT-II)**:
219
+
220
+ $$
221
+ c(m,i) \;=\; \sum_{j=1}^{M} \log E_{\text{mel}}(m,j)\,
222
+ \cos\!\left[\frac{\pi i}{M}\left(j - \tfrac{1}{2}\right)\right], \qquad i = 0,\dots,19 .
223
+ $$
224
+
225
+ We keep the first **20** coefficients (`mfcc0…mfcc19`). Low-order coefficients capture the
226
+ **smooth spectral envelope** (formant structure → which phoneme is spoken); $c(m,0)$ is
227
+ proportional to overall log-energy. MFCCs are the single most important speech feature
228
+ historically and are nearly **uncorrelated**, which suits linear models well.
229
+
230
+ ### 5.3 Delta ($\Delta$) and delta-delta ($\Delta\Delta$) coefficients
231
+
232
+ A single frame says nothing about *motion*. The **delta** features approximate the temporal
233
+ derivative of each coefficient with a regression over $\pm\Theta$ frames:
234
+
235
+ $$
236
+ \Delta c(m,i) \;=\; \frac{\displaystyle\sum_{\theta=1}^{\Theta} \theta\,\bigl[c(m+\theta,i) - c(m-\theta,i)\bigr]}
237
+ {\displaystyle 2\sum_{\theta=1}^{\Theta} \theta^{2}} .
238
+ $$
239
+
240
+ The **delta-delta** (acceleration) features are the deltas of the deltas. Columns
241
+ `d1_0…d1_19` ($\Delta$) and `d2_0…d2_19` ($\Delta\Delta$). *Interpretation:* how fast the
242
+ spectrum is changing — crucial for distinguishing a short, dynamic spoken word from
243
+ quasi-stationary noise or music.
244
+
245
+ ### 5.4 Spectral centroid
246
+
247
+ The "centre of mass" of the spectrum — a strong correlate of perceived **brightness**:
248
+
249
+ $$
250
+ \text{centroid}(m) \;=\; \frac{\sum_{k} f_k \,|X(m,k)|}{\sum_{k} |X(m,k)|}.
251
+ $$
252
+
253
+ ### 5.5 Spectral bandwidth
254
+
255
+ The spread of energy around the centroid (here the $p=2$, i.e. standard-deviation, form):
256
+
257
+ $$
258
+ \text{bandwidth}(m) \;=\;
259
+ \left( \frac{\sum_{k} |X(m,k)|\,\bigl(f_k - \text{centroid}(m)\bigr)^{2}}
260
+ {\sum_{k} |X(m,k)|} \right)^{1/2}.
261
+ $$
262
+
263
+ ### 5.6 Spectral roll-off
264
+
265
+ The frequency $f_R(m)$ below which a fraction $\rho = 0.85$ of the total spectral energy lies:
266
+
267
+ $$
268
+ f_R(m) = \min\Big\{ f_K \;:\; \sum_{k:\,f_k \le f_K} |X(m,k)| \;\ge\; \rho \sum_{k} |X(m,k)| \Big\}.
269
+ $$
270
+
271
+ Separates voiced/low-frequency-dominated frames from broadband/fricative ones.
272
+
273
+ ### 5.7 Spectral flatness
274
+
275
+ The ratio of the **geometric** to the **arithmetic** mean of the power spectrum — a
276
+ *tonality vs. noisiness* measure in $[0,1]$:
277
+
278
+ $$
279
+ \text{flatness}(m) \;=\;
280
+ \frac{\exp\!\left(\frac{1}{K}\sum_{k}\ln S(m,k)\right)}{\frac{1}{K}\sum_{k} S(m,k)}.
281
+ $$
282
+
283
+ A value near $1$ ⇒ white-noise-like (flat); near $0$ ⇒ tonal/harmonic (peaky), as in voiced
284
+ speech. Very useful for telling speech from noise/music.
285
+
286
+ ### 5.8 Spectral contrast
287
+
288
+ For each of **7 sub-bands** $b$, the (log) difference between the strongest **peaks** and the
289
+ weakest **valleys** in that band:
290
+
291
+ $$
292
+ \text{contrast}(m,b) \;=\; \overline{\text{Peak}}_b(m) \;-\; \overline{\text{Valley}}_b(m),
293
+ $$
294
+
295
+ where the peak/valley terms are the mean log-energies of the top/bottom quantile of bins in
296
+ band $b$. High contrast ⇒ clear harmonic structure (formants stand out over the noise floor).
297
+ Columns `contrast0…contrast6`. *In our baseline this was the single most informative group.*
298
+
299
+ ### 5.9 Chroma
300
+
301
+ Projects the spectrum onto the **12 pitch classes** of the equal-tempered scale:
302
+
303
+ $$
304
+ \text{chroma}(m,p) \;=\; \sum_{k\,:\,\text{pitch-class}(f_k)=p} |X(m,k)|, \qquad p = 0,\dots,11 .
305
+ $$
306
+
307
+ Octave-invariant harmonic content. Borrowed from music IR; for speech it is a weak but
308
+ non-trivial cue. Columns `chroma0…chroma11`.
309
+
310
+ ### 5.10 Zero-Crossing Rate (ZCR)
311
+
312
+ A cheap time-domain measure of how often the waveform changes sign within a frame of length $L$:
313
+
314
+ $$
315
+ \text{ZCR}(m) \;=\; \frac{1}{2L}\sum_{n}\bigl|\operatorname{sgn} x(n) - \operatorname{sgn} x(n-1)\bigr|.
316
+ $$
317
+
318
+ High ZCR ⇒ noisy/fricative/unvoiced; low ZCR ⇒ voiced/low-frequency. A classic voicing proxy.
319
+
320
+ ### 5.11 Root-Mean-Square energy (RMS)
321
+
322
+ Per-frame loudness:
323
+
324
+ $$
325
+ \text{RMS}(m) \;=\; \sqrt{\frac{1}{L}\sum_{n} x(n)^{2}} .
326
+ $$
327
+
328
+ Tracks the speech envelope (syllable onsets/offsets, silences).
329
+
330
+ ---
331
+
332
+ ## 6. Temporal aggregation: variable-length audio → fixed vector
333
+
334
+ The features above produce **one value per frame**, so a clip is a *matrix* $\phi(m)$ of shape
335
+ (features × frames), and clips have **different numbers of frames** (different durations).
336
+ Classical models need a **fixed-length** vector. We therefore summarise each per-frame feature
337
+ $\phi$ over its $T$ frames by its **mean** and **standard deviation**:
338
+
339
+ $$
340
+ \mu_\phi = \frac{1}{T}\sum_{m=1}^{T} \phi(m), \qquad
341
+ \sigma_\phi = \sqrt{\frac{1}{T}\sum_{m=1}^{T}\bigl(\phi(m) - \mu_\phi\bigr)^{2}} .
342
+ $$
343
+
344
+ Hence every group contributes **two** columns per channel (`…_mean`, `…_std`), and *every clip
345
+ maps to the same 250-dimensional vector* regardless of length. The `std` summaries turn out to
346
+ be very informative — they encode *how much the spectrum moves over time*, which separates a
347
+ short spoken word from stationary background. (In our baseline, several `…_std` features rank
348
+ at the very top of tree-based feature importances.)
349
+
350
+ > **Design choice / leakage note.** Clip **duration is deliberately *not* a feature.** In the
351
+ > raw corpus all `podcast` negatives are exactly 2.000 s while positives are shorter, so
352
+ > duration alone would let a model "cheat". Aggregating to mean/std makes the descriptor
353
+ > length-invariant and removes that shortcut. (The deeper *synthetic-vs-real* shortcut remains
354
+ > — see §8.)
355
+
356
+ ### Feature budget (250 total)
357
+
358
+ | Group | Per-frame channels | × {mean, std} | Columns |
359
+ |---|---:|---:|---:|
360
+ | MFCC | 20 | 2 | 40 |
361
+ | $\Delta$ MFCC | 20 | 2 | 40 |
362
+ | $\Delta\Delta$ MFCC | 20 | 2 | 40 |
363
+ | log-mel energies | 40 | 2 | 80 |
364
+ | spectral contrast | 7 | 2 | 14 |
365
+ | chroma | 12 | 2 | 24 |
366
+ | centroid | 1 | 2 | 2 |
367
+ | bandwidth | 1 | 2 | 2 |
368
+ | roll-off | 1 | 2 | 2 |
369
+ | flatness | 1 | 2 | 2 |
370
+ | ZCR | 1 | 2 | 2 |
371
+ | RMS | 1 | 2 | 2 |
372
+ | **Total** | | | **250** |
373
+
374
+ ---
375
+
376
+ ## 7. Dataset schema
377
+
378
+ One parquet file, **40 000 rows × 252 columns**, all features `float32`, no missing values.
379
+
380
+ | Column(s) | Type | Role | Notes |
381
+ |---|---|---|---|
382
+ | `mfcc{0..19}_{mean,std}` | float32 | feature | cepstral envelope |
383
+ | `d1_{0..19}_{mean,std}` | float32 | feature | $\Delta$ MFCC |
384
+ | `d2_{0..19}_{mean,std}` | float32 | feature | $\Delta\Delta$ MFCC |
385
+ | `mel{0..39}_{mean,std}` | float32 | feature | log-mel energies (dB) |
386
+ | `contrast{0..6}_{mean,std}` | float32 | feature | spectral contrast |
387
+ | `chroma{0..11}_{mean,std}` | float32 | feature | pitch-class energy |
388
+ | `centroid_{mean,std}` | float32 | feature | brightness |
389
+ | `bandwidth_{mean,std}` | float32 | feature | spectral spread |
390
+ | `rolloff_{mean,std}` | float32 | feature | 85 % roll-off freq. |
391
+ | `flatness_{mean,std}` | float32 | feature | tonality |
392
+ | `zcr_{mean,std}` | float32 | feature | zero-crossing rate |
393
+ | `rms_{mean,std}` | float32 | feature | loudness |
394
+ | **`label`** | int | **target** | `1` = «Акылай», `0` = negative |
395
+ | **`source`** | string | **metadata** | `positive` / `base_neg` / `confusable` / `podcast` — **do not train on this** |
396
+
397
+ **Class balance:** 10 000 positive / 30 000 negative (**25 % positive, 1 : 3**).
398
+
399
+ ---
400
+
401
+ ## 8. Modeling challenges
402
+
403
+ This is where the dataset earns its keep as a teaching tool. Things students *should* run into:
404
+
405
+ 1. **Class imbalance → accuracy lies.** A constant "always negative" classifier already scores
406
+ **75 % accuracy** but is useless (F1 = 0, PR-AUC = 0.25). Insist on **precision, recall,
407
+ F1, ROC-AUC, and especially PR-AUC**, plus the confusion matrix. Tools to discuss:
408
+ `class_weight="balanced"`, threshold tuning, resampling.
409
+
410
+ 2. **The synthetic-vs-real shortcut (the big one).** Positives are TTS; `podcast` negatives are
411
+ real human speech. A model can score deceptively well by learning *"synthetic timbre vs.
412
+ real"* instead of *"the word Akylai vs. other words"*. The antidote is **per-`source` error
413
+ analysis**: evaluate false-positive rate **separately** on `podcast`, `base_neg`, and
414
+ `confusable`. The honest difficulty lives in `base_neg` (same TTS voice, different word).
415
+
416
+ 3. **Operating point & asymmetric costs.** F1 is not the deployment metric; real KWS cares
417
+ about *recall at a fixed false-alarm rate*. Sweep the threshold $\tau$ and read off the
418
+ precision/recall trade-off — a natural lead-in to ROC and PR curves.
419
+
420
+ 4. **Feature scaling matters — but only for some models.** Distance/margin-based learners
421
+ (Logistic Regression, SVM, k-NN) need `StandardScaler`; tree ensembles
422
+ (Random Forest, Gradient Boosting) are scale-invariant. A clean side-by-side lesson.
423
+
424
+ 5. **High dimensionality & redundancy.** 250 features, many correlated (MFCC vs. mel; mean vs.
425
+ std). Good ground for regularisation ($L_1/L_2$), feature importance, and dimensionality
426
+ reduction. Note that in a 2-D **PCA** projection the classes **overlap heavily** — a useful
427
+ reminder that "I can't see a boundary in 2-D" does *not* mean the classes are inseparable in
428
+ 250-D.
429
+
430
+ 6. **Speaker / generator leakage.** Positives come from a limited set of synthetic voices; a
431
+ purely random train/test split can leak speaker identity and **inflate** scores. A stricter
432
+ evaluation would split by speaker or by source. Worth at least *discussing*.
433
+
434
+ 7. **It's "easy enough" to be encouraging, hard enough to be real.** Even a linear model
435
+ reaches high PR-AUC on these features, so beginners get a rewarding result quickly — while
436
+ the per-source breakdown leaves a genuine, interpretable hard core to dig into.
437
+
438
+ ---
439
+
440
+
441
+ ## 9. License, provenance & citation
442
+
443
+ - **License:** Apache-2.0.
444
+ - **Languages:** Kyrgyz (`ky`), with some Russian (`ru`) confusables.
445
+ - **Audio provenance:** positives and `base_neg` are generated by an in-house Kyrgyz
446
+ text-to-speech model (trained on podcast voices); `confusable` clips are generated by
447
+ **KaniTTS**; `podcast` negatives are 2-second cuts of real Kyrgyz-language podcast speech.
448
+ Features were extracted with `librosa` (16 kHz, $N_{\text{fft}}=512$, hop $=160$).
449
+ - **Parent project:** the «Акылай» on-device wake-word detector
450
+ (`KaniTTS-research-team/AkylAi_Wake_Word_V4`). This features table is a derived, tabular
451
+ **teaching** snapshot — it does **not** contain audio.
452
+
453
+ ```bibtex
454
+ @misc{akylai_kws_features,
455
+ title = {Akylai KWS Features: An Educational Spectral-Feature Dataset for Keyword Spotting},
456
+ author = {AkylAi Wake Word project},
457
+ year = {2026},
458
+ note = {Derived tabular features (MFCC + spectral descriptors) over the Akylai wake-word corpus},
459
+ license = {Apache-2.0}
460
+ }
461
+ ```
462
+
463
+ > **Educational use.** This dataset is intended for teaching classification and audio feature
464
+ > engineering. The synthetic positives and the domain split between TTS and real speech make it
465
+ > unsuitable as-is for benchmarking a production wake-word detector.
data/train-00000-of-00001.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:370cfe0f24937bbd2ecc5b329ac7752938415406676d5811aec90232075c846f
3
+ size 59393466