POST 1 of 5 MorningAI/MLConcept
SVMs — find the widest margin
📅 Day 42. Last day of week six. 📐 Support Vector Machines were the dominant ML algorithm of the 2000s. They've lost ground to gradient boosting on tabular and to deep learning on unstructured data. Still worth understanding — the margin idea shows up in modern contrastive learning. 🎯 The core idea — find the hyperplane that separates two classes with the largest possible 'margin' (gap between classes). The points closest to this hyperplane are 'support vectors' (hence the name). The hyperplane is positioned to maximise its distance from these support vectors. 📊 Why max-margin matters. A separating hyperplane that's right at the boundary of one class has zero margin — small perturbations in test data cross it, leading to wrong predictions. A hyperplane that's centered between classes has high margin — robust to perturbations, generalises better. 🧮 Mathematical guarantee. Statistical learning theory provides bounds on test error based on margin. Larger margin → tighter bound → better generalisation. This was a big deal in the 2000s before neural networks empirically beat the bounds. 🌀 Kernels. SVMs can implicitly map features into much higher-dimensional space without computing the mapping explicitly. RBF (Gaussian) kernel handles non-linear boundaries. Polynomial kernel captures polynomial relationships. The 'kernel trick' was groundbreaking — non-linearity at modest computational cost. ⚠️ Why SVMs lost ground: → Doesn't scale to huge datasets. Training is O(n²) or worse. → Tabular data is owned by gradient boosting (smaller, faster, often more accurate). → Unstructured data is owned by deep learning. → Hyperparameter tuning is harder than for tree models. 💡 Where SVMs still shine — small datasets (a few hundred samples) where you need a strong baseline. Text classification with TF-IDF features used to be SVM territory before transformers. Some niche cases in finance and biology. 🚀 Worth knowing for the principles. Margin, kernels, support vectors — all concepts you'll see in modern self-supervised learning.
#MachineLearning#scikitlearn#Python#AI#100DaysOfCode#SVM