Projects

svd-audio — Denoising audio with low-rank approximation

Problem. Remove pink noise from a birdsong recording without a trained model.

Method. STFT and ISTFT implemented from scratch in NumPy. The magnitude spectrogram AA is replaced by its best rank-kk approximation from the singular value decomposition,

Ak=∑i=1kσi uivi⊤,A_k = \sum_{i=1}^{k} \sigma_i \, u_i v_i^{\top},

which keeps the structured signal and discards the noise spread across the small singular values. A bird repeats a small vocabulary of syllables, so its spectrogram is close to low-rank; broadband noise is not. A second experiment uses non-negative matrix factorization and the Griffin–Lim algorithm to rebuild a human voice out of birdsong.

Magnitude spectrogram of the selected signal
Signal

Rank-k approximation of a noisy spectrogram: 12 seconds of a Eurasian golden oriole recording (Xeno-canto XC1161210) with pink noise added at 0 dB SNR. Move the slider and play each version; playback position is kept when you switch.

Result. With noise added at a known 0 dB SNR, the best rank for this 12-second clip is kk = 11 of 513. Truncation alone raises the SNR by 0.63 dB; subtracting the per-frequency noise floor before truncating raises it by 2.89 dB. Truncation removes the variation of the noise but not its floor, which is why the second step matters.

luck-defense — A probability-balanced tower defense engine

Problem. Balance a randomized tower defense game using measured clear rates rather than intuition.

Method. Thirty waves on a closed circular track; units arrive by a gacha roll, and monsters that survive keep circling into the next wave. The game core is deterministic, uses a seeded random number generator and never touches the DOM, so a headless simulator can play it with scripted policies. Balance is tested against two targets at once: about 20% clear rate for strategic play and 0–2% for random input. If only the first holds, luck doesn’t matter; if only the second holds, skill doesn’t matter. TypeScript, React and Canvas, with all graphics and audio generated in code.

Result. Over 100 seeded runs per policy, a heuristic policy clears 22% of runs and random play clears 0%. Single-class policies exposed a dominant strategy: an all-mage board cleared 90% of runs. The cause was a DPS model that ignored track coverage and splash damage with no falloff. After fixing both, the all-mage clear rate fell to 35%.

CxC-hackathon — Predicting wildfire size in Alberta

Problem. Classify the size of Alberta wildfires from 18 years of fire data, as machine learning lead at the University of Waterloo Data Science Club CxC Hackathon.

Method. Weather and spread-rate features with polynomial terms to capture non-linear effects. Linear and logistic regression implemented from scratch in NumPy with vectorized gradient descent, tuned using train and cross-validation learning curves.

Result. 96.4% predictive accuracy on fire size classification; Mathematics Endowment Fund (MEF) Award, 2024.

signal-for-help — Real-time gesture recognition

Problem. Detect the “Signal for Help” distress gesture from a live camera feed, at any hand size or camera distance.

Method. A real-time OpenCV pipeline over MediaPipe hand landmarks. The gesture is detected as a two-step temporal sequence: thumb tuck, then finger closure. Every Euclidean distance threshold is normalized by the computed hand size, which makes detection scale-invariant.