sam.chong

Finding better ways to solve practical problems.

Most of my projects start with “there has to be a better way.” AI always agrees. Then we go exploring.

Who voted how: Malaysian elections

  • Python
  • R
  • regression
  • Bayesian inference
  • MCMC
  • cloud computing

I estimated how different ethnic and age groups voted in Peninsular Malaysia’s general elections from 2008 to 2022, and in several state elections, using polling-district results and demographics. Results are only published as totals, so group-level patterns have to be estimated.

What I did
  • Built one dataset across four general elections and several state elections, mapping parties to coalitions as alliances changed.
  • Estimated group voting with two methods, a fast regularised regression and a hierarchical Bayesian model, and compared them.
  • Compared newly registered voters with established ones after the voting age was lowered to 18.
  • Ran Monte Carlo seat simulations and “what if” scenarios, such as two coalitions combining.
  • Ran long model jobs on cloud machines and recovered them when they were interrupted.

How I check it Regression estimates get two checks: a refit without the model’s limits and a bootstrap confidence interval. Those that fail are flagged rather than reported. Bayesian results are checked for convergence across three independent chains and compared against the regression.

Two line charts of estimated vote choice in Peninsular Malaysia’s general elections, 2008 to 2022. Among Malay electors, BN falls from about half in 2013 to about a quarter in 2022, while PN rises to about 42 percent. Among Chinese electors, PH rises to about three quarters in 2018 and BN falls below 5 percent. Regression and Bayesian estimates mostly overlap.
Two methods, four elections: the regression rings mostly sit on the Bayesian lines. Indian and Other electors are not shown: their estimates failed the reliability checks or the two methods disagreed. Open the chart full size.

Store-mapping pipeline

  • Python
  • Playwright
  • geocoding
  • OpenStreetMap

A pipeline for collecting official store lists, geocoding locations, and checking them against other sources. The scope is up to five brands in each of 50 countries; coverage is still incomplete.

Breaking a larger data task into work that can be built and reviewed separately.

What I worked through I set up three AI sessions with different roles: a coordinator plans tasks, a builder implements them, and a reviewer checks the work. A shared handoff file lets later sessions pick up where earlier ones left off. This has helped me work on the project over several weeks.

How I check it The reviewer works in a separate session and cannot edit the code. Automated tests support the review, and store lists are cross-checked against independent sources.

Three AI sessions working as a team The coordinator sends a task to the builder; the builder's work goes to a read-only reviewer; the reviewer returns pass, fail or escalate to the coordinator. All three read and write a shared handoff file. Coordinatorsplits work into tasks Builderone task at a time Reviewerread-only, can't edit pass · fail · escalate Handoff fileshared memory across sessions
The coordinator sends a task to the builder. The reviewer returns pass, fail, or escalate. All three use a shared handoff file.

Pocket Ledger: expenses from plain notes

  • JavaScript
  • Cloudflare Workers
  • Google Sheets API

A personal expense tracker I built with an AI coding agent. I write my spending as one plain note; AI turns it into entries that I review before saving. Records sync to Google Sheets.

Pocket Ledger screen: a mixed Chinese and English spending note on the left, and the three ledger entries it produced on the right (coffee RM 8.00, lunch RM 18.50, Grab RM 12.00).
One mixed-language note became three entries. The interface is in Chinese; the example expenses are fictional.

Podcast caption cards

  • Remotion
  • React
  • TypeScript
  • speech-to-text

A workflow that turns podcast transcripts into animated caption cards with source references, then renders them over the episode video.

Bringing transcription, card preparation, and rendering into one workflow.

What I worked through AI helps transcribe the episode, identify claims to illustrate, find sources, write cards, and render the video. Production rules and known pitfalls are recorded in the project so the next episode starts with those lessons.

How it is checked Claims on the cards include source references. The project also records production checks and known pitfalls for subsequent episodes.

A 30-second excerpt from a real episode. The podcast and its cards are in Chinese.

Also built: an internal ticket and task tool for a data team, with developer queues and multiple assignees per ticket. It is in testing; no screenshots are included because it is a work tool.

Notes to myself