Working with a Linear SVM
For this example, we will create a linear separator from the iris
data set. We know from prior chapters that the sepal length and petal width create a linear separable binary data set for predicting if a flower is I. setosa or not.
Getting ready
To implement a soft separable SVM in TensorFlow, we will implement the specific loss function, as follows:
Here, A is the vector of partial slopes, b is the intercept, is a vector of inputs, is the actual class, (-1 or 1) and is the soft separability regularization parameter.
How to ...
Get TensorFlow Machine Learning Cookbook now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.