Rust SVM from scratch hits 96% accuracy with SMO optimization
A Reddit user builds a custom SVM with 96% accuracy and 100% recall.
A developer known as u/Yeet132416 shared their implementation of a Support Vector Machine (SVM) classifier built entirely from scratch in Rust. The model uses Sequential Minimal Optimization (SMO) to train efficiently, supports both linear and RBF (Radial Basis Function) kernels, and includes a grid search mechanism for hyperparameter tuning. The results are impressive: on the Banknote Authentication dataset, the SVM achieved 96% accuracy, 94% recall, and a 95% F1 score. On the Breast Cancer dataset, it reached 93% accuracy, 100% recall, and 92% F1.
The developer notes that the only AI-assisted part was the plotting code (using the `plotters` crate), which they couldn't figure out manually. The rest of the code—including the core SVM algorithm, kernel functions, SMO optimizer, and grid search—is entirely original. The project is open-source on GitHub, inviting feedback from the Rust and ML communities. This showcases Rust's growing role in high-performance machine learning, where manual optimization can yield production-ready results.
- Built an SVM from scratch in Rust using SMO optimization with linear and RBF kernels.
- Achieved 96% accuracy on Banknote Authentication and 93% on Breast Cancer datasets.
- Grid search tunes hyperparameters; only plotting was AI-assisted.
Why It Matters
Demonstrates Rust's viability for production ML, offering performance and control without relying on Python libraries.