Well, I did it to myself again. Once a technical problem gets lodged into my brain, I literally can’t sleep until I solve the problem.
This time it was support vector machines (SVMs). An SVM is a machine learning system that can make binary classification predictions (such as patient lives or patient dies). SVMs are very tricky to implement from scratch, and so most people, including me, usually use a machine learning library of some sort.
But I’m never 100% satisfied that I truly understand an ML system unless I can implement it from scratch. So, after a sleepless night, tossing and turning and reviewing the SVM sequential minimal optimization (SMO) algorithm, I came into work uber-early and starting writing code.
A few hours later, I was tired but intellectually happy.
I cheated a bit by hard-coding a particular kernel function, a polynomial kernel, into the SVM implementation. But it would be an easy matter to pass a kernel function in as an object or a delegate or an interface.
To be sure, I leveraged a lot of resources. In particular I looked at one of the early research papers by John Platt, who is a former work colleague of mine but who now works at Google; the Accord.NET library SVM code which was written mostly, I believe, by a guy named Cesar Souza; the LibSvm C++ library code written by some researchers in Taiwan; and Python code from a guy named Alexandre Kowalczyk who wrote an entire book on SVMs that I tech-reviewed.
So, now I’ll be able to sleep again. At least until the next technical challenge lodges itself into my brain.


.NET Test Automation Recipes
Software Testing
SciPy Programming Succinctly
Keras Succinctly
R Programming
2026 Visual Studio Live
2025 Summer MLADS Conference
2025 DevIntersection Conference
2025 Machine Learning Week
2025 Ai4 Conference
2025 G2E Conference
2025 iSC West Conference
any chance you might share it on github ? 😉
I’m cleaning up the code a bit — it’s extremely tricky. It’ll take me a few weeks then I’m going to publish the corrected code on MSDN Magazine — probably in December.