
Explore support vector machines in Python, starting with logistic regression intuition and geometry of lines, planes, and hyperplanes. Extend to end-to-end practical applications such as image recognition and spam detection.
Discover the theory-first objectives of this SVM course, emphasizing understanding over coding, covering hyperparameters and applications to image recognition, medical diagnosis, spam detection, and regression.
Outline the theory and coding of support vector machines in Python, covering linear SVMs, margins, and duality. Explore practical applications such as image recognition, spam detection, and medical diagnosis.
Access the course code from the GitHub repository using git clone, avoid forking, and retrieve the data from Kaggle with train.csv in the large files folder for hands-on svm practice.
Explore the beginner's corner, where practical SVM usage on data is demonstrated through image classification with the handwritten digits MLS dataset, breast cancer diagnosis, and concrete strength regression.
Classify handwritten digits with support vector machines in Python by flattening 28x28 images to 784 features, scaling to 0–1, then training and evaluating on train and test sets.
Apply a support vector machine to detect spam in sms messages using tf-idf features and a train-test split, achieving about 98% accuracy while examining misclassified examples.
Apply support vector machines to breast cancer diagnosis, comparing linear and RBF kernels on scaled real-valued features to predict malignant versus benign with train-test evaluation.
Explore regression with support vector machines using SVR on the concrete strength data to predict strength from real-valued features, with polynomial and RBF kernel options.
Explore cross-validation and grid search for evaluating SVM hyperparameters with a pipeline that scales data and uses cross_val_score across folds to report mean accuracy and variability.
Explore how to get and format data, train a model, make predictions, and evaluate SVMs for classification and regression using data organized as a table of numbers.
Encourage feedback through a simple suggestion box. Ask for background, course, difficulty, missing explanations or algorithms, and requests for topics like CNNs, transformers, or quantum mechanics to shape future lessons.
Frame linear classification as a geometry problem, separating data with lines and planes using the form W transposed X plus b. Explore dimensionality, hyperplanes, and SVM concepts in practice.
Learn how the weight vector serves as a normal to the hyperplane in SVMs, deriving the plane equation w^T x + b = 0 from perpendicularity and the dot product.
Explore the intuition of logistic regression as a probabilistic linear classifier, using the sigmoid to map W^T X + b to P(Y=1|X) and train with cross-entropy loss via gradient descent.
Add a regularization term, proportional to the squared magnitude of the weights, to the logistic regression loss, balancing error and weight size to prevent infinity and instability.
Explore how logistic regression uses a sigmoid to assign probabilities based on distance from the separating line, while SVM seeks a line far from all training points to maximize confidence.
Explore how to handle nonlinear problems with support vector machines in Python by using feature engineering and polynomial expansions, including distance-based features and interaction terms.
Treat linear classifiers as geometry problems using W^T X + B to define the boundary. Use logistic regression with loss and regularization, then prepare for SVM with nonlinear features.
Explore linear SVMs in Python as maximum margin classifiers, covering margins, quadratic programming, soft margin with misclassified points, and the link to logistic regression losses.
this lecture explains the intuition of linear SVM, defining the best line as the middle between two data clouds and maximizing the margin, i.e., the minimum distance to points.
Explore linear SVM margins by defining the functional and geometric margins, and relate them to the separating hyperplane, the distance to data points, and scale invariance.
derive the svm objective by tying geometric and functional margins, fix the functional margin to one, and minimize the squared norm of w under y_i(w^T x_i + b) ≥ 1.
Discover linear and quadratic programming concepts, from production and regression examples to portfolio optimization, with linear constraints and a quadratic objective, all in the context of SVM in Python.
Explore soft margin support vector machines in Python, introducing slack variables to handle nonlinearly separable data and outliers, balancing margin size with misclassification penalty via the C parameter.
Explore hinge loss and its relation to logistic regression, compare SVM and logistic loss, and understand margin constraints and robust classification.
Implement a linear SVM trained with gradient descent in Python, applying it to the breast cancer data set and Gaussian clouds, and visualize the decision boundary with margins.
Explore the linear SVM in Python as a maximum margin classifier, define functional and geometric margins, and learn how quadratic programming and slack variables enable soft margins and hinge loss.
Explore primal and dual optimization to transform linear SVM into nonlinear SVM, and learn how support vectors and product-based training and prediction enable nonlinear classification with linearly separable data.
Explore primal duality in support vector machines using Lagrange multipliers and the Lagrangian to derive conditions that align primal and dual problems, including equality and inequality constraints.
Apply lagrangian duality to svm objective, transform primal into its dual, derive W = sum_i alpha_i y_i phi(x_i) and impose sum_i alpha_i y_i = 0 with alpha_i ≥ 0.
Derive the linear program dual from the primal with the Lagrangian and multipliers, impose y ≥ 0 and a^T y = C, and relate it to the SVM dual.
Solving the dual problem yields alphas, revealing the support vectors on the margin. Use training data and these alphas to compute w and b for predictions.
Explain why transforming the primal to the dual shifts computations from feature dimensionality to the sample count, enabling sparse predictions via a small set of support vectors.
Discover how duality yields a dual quadratic program for SVMs by using Lagrange multipliers and the Lagrangian, with KKT conditions linking primal and dual solutions and dot products.
Explore kernel methods in support vector machines to create nonlinear SVMs in Python using the kernel trick, including polynomial, Gaussian, and sigmoid kernels, and verify with Mercers condition.
Transform linear SVM into nonlinear SVM using the kernel trick, replacing explicit feature expansion with kernel functions for efficient, high-dimensional learning.
Explore polynomial kernels in SVMs to capture polynomial terms without expanding features, including linear terms, interaction terms, and a constant term, for any degree.
Explore the Gaussian kernel (rbf) for support vector machines, showing its value depends only on distance, how gamma controls kernel bandwidth, and the need for data normalization.
Learn how to tune the Gaussian kernel SVM by selecting gamma and C, balancing misclassification penalties, bias-variance, and the complexity of the decision boundary with respect to overfitting and underfitting.
Demonstrate that the Gaussian kernel corresponds to infinite dimensional features and remains a valid kernel expressed as a dot product expansion.
Explore less popular kernels for nonlinear SVMs, including the sigmoid kernel and its neural network parallels. Learn how string kernels apply to non-numeric data and note Mercer’s condition limitations.
Explore Mercer's condition by verifying the kernel matrix is positive semidefinite for the training data, linking kernel validity to a dot-product feature expansion.
Apply kernel SVMs to create non-linear decision boundaries using the kernel trick, tune bias-variance with C and gamma, and explore polynomial, Gaussian, sigmoid, and string kernels, guided by Mercer's condition.
Reintroduce slack variables into the dual of the support vector machine to enable regularization and misclassifications, yielding a nonlinear model and clarifying alpha cases for margins and support vectors.
Explore simple approaches to implementing SVMs in Python. Use projected gradient descent with alpha constraints and derive the bias from margin points.
Explore implementing an SVM with projected gradient descent in Python, using linear, RBF, and sigmoid kernels, training with alpha updates, bias calculation, and decision boundaries.
Demonstrate kernel svm via gradient descent in the primal, using a parameterization u and the kernel trick to avoid deriving the dual.
This lecture implements a kernel SVM with gradient descent on the primal, building kernel matrix and updating the primal variables and bias, then tests on spiral, clouds, and donut data.
Learn how the SMO algorithm for training support vector machines in Python uses coordinate ascent to optimize two alphas at a time, respecting the zero-sum and box constraints.
Translate support vector machines to regression using epsilon-insensitive loss and two slack variables per data point, derive the dual form, and apply the kernel trick for regression.
Explore how to apply SVM to multiclass classification using one versus all and one versus one strategies, compare training costs, voting predictions, and practical implementation with Python and libsvm.
Introduce the next section of the course on support vector machines in python. Explore the rbf network with landmarks and random kitchen sinks as a fast bridge to neural networks.
Explore how radial basis function networks use gaussian kernels and support vectors to shape the SVM decision boundary in Python, with alpha and bias parameters and gamma controlling kernel precision.
Discover scalable approximations for RBF networks in Python, including the RBF sampler and Nyström method, to approximate kernels with low-dimensional feature transformers and a linear model.
This lecture resolves the paradox of infinite dimensional feature expansion with the gaussian kernel by contrasting explicit kernel outputs with implicit feature expansions in svm, using a two-stage rbf view.
Build your own rbf network in python by combining rbf samplers with a linear classifier, using a feature union for multiple samplers and evaluating train/test accuracy around 95%.
Discover the relationship between support vector machines and neural networks, comparing Gaussian and sigmoid kernels, and analyzing input-to-hidden mappings, weights, and entropy-based ambiguity in data.
Explores a neural network SVM hybrid by selecting random or uncertain training points as static weights, using k-means or gaussian mixtures, and evaluating with sigmoid kernel and cross-validation.
View SVMs as neural networks, form an rbf network with gaussian kernel, apply a two-stage feature extraction and linear classification, and compare random kitchen sink, Nyström, and sigmoid kernel landmarks.
Clarify the appendix and FAQ concepts, show why the appendix is optional, and guide you to use the Q&A for immediate answers and course clarity.
Perform a pre-installation check by understanding installation guidelines, prioritize learning principles over syntax, and select course-relevant Python libraries instead of outdated ones.
Install data science libraries on Windows with one-click Anaconda, isolating environments and Python versions, including NumPy, SciPy, Matplotlib, and Pandas, then add TensorFlow and PyTorch via pip or conda.
Set up a cross-platform development environment for machine learning, installing NumPy, SciPy, Matplotlib, Pandas, IPython, Theano, and TensorFlow via a virtual machine with Ubuntu.
Support Vector Machines (SVM) are one of the most powerful machine learning models around, and this topic has been one that students have requested ever since I started making courses.
These days, everyone seems to be talking about deep learning, but in fact there was a time when support vector machines were seen as superior to neural networks. One of the things you’ll learn about in this course is that a support vector machine actually is a neural network, and they essentially look identical if you were to draw a diagram.
The toughest obstacle to overcome when you’re learning about support vector machines is that they are very theoretical. This theory very easily scares a lot of people away, and it might feel like learning about support vector machines is beyond your ability. Not so!
In this course, we take a very methodical, step-by-step approach to build up all the theory you need to understand how the SVM really works. We are going to use Logistic Regression as our starting point, which is one of the very first things you learn about as a student of machine learning. So if you want to understand this course, just have a good intuition about Logistic Regression, and by extension have a good understanding of the geometry of lines, planes, and hyperplanes.
This course will cover the critical theory behind SVMs:
Linear SVM derivation
Hinge loss (and its relation to the Cross-Entropy loss)
Quadratic programming (and Linear programming review)
Slack variables
Lagrangian Duality
Kernel SVM (nonlinear SVM)
Polynomial Kernels, Gaussian Kernels, Sigmoid Kernels, and String Kernels
Learn how to achieve an infinite-dimensional feature expansion
Projected Gradient Descent
SMO (Sequential Minimal Optimization)
RBF Networks (Radial Basis Function Neural Networks)
Support Vector Regression (SVR)
Multiclass Classification
For those of you who are thinking, "theory is not for me", there’s lots of material in this course for you too!
In this course, there will be not just one, but two full sections devoted to just the practical aspects of how to make effective use of the SVM.
We’ll do end-to-end examples of real, practical machine learning applications, such as:
Image recognition
Spam detection
Medical diagnosis
Regression analysis
For more advanced students, there are also plenty of coding exercises where you will get to try different approaches to implementing SVMs.
These are implementations that you won't find anywhere else in any other course.
Thanks for reading, and I’ll see you in class!
"If you can't implement it, you don't understand it"
Or as the great physicist Richard Feynman said: "What I cannot create, I do not understand".
My courses are the ONLY courses where you will learn how to implement machine learning algorithms from scratch
Other courses will teach you how to plug in your data into a library, but do you really need help with 3 lines of code?
After doing the same thing with 10 datasets, you realize you didn't learn 10 things. You learned 1 thing, and just repeated the same 3 lines of code 10 times...
Suggested Prerequisites:
Calculus
Matrix Arithmetic / Geometry
Basic Probability
Logistic Regression
Python coding: if/else, loops, lists, dicts, sets
Numpy coding: matrix and vector operations, loading a CSV file
WHAT ORDER SHOULD I TAKE YOUR COURSES IN?:
Check out the lecture "Machine Learning and AI Prerequisite Roadmap" (available in the FAQ of any of my courses, including the free Numpy course)
UNIQUE FEATURES
Every line of code explained in detail - email me any time if you disagree
No wasted time "typing" on the keyboard like other courses - let's be honest, nobody can really write code worth learning about in just 20 minutes from scratch
Not afraid of university-level math - get important details about algorithms that other courses leave out