Skip to content

Commit

Permalink
Links with relative paths
Browse files Browse the repository at this point in the history
  • Loading branch information
havk64 committed Feb 5, 2017
1 parent d2a57dc commit 201c65f
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion 04_Support_Vector_Machines/01_Introduction/readme.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Support Vector Machine Introduction

![Linear Separator](https://github.com/nfmcclure/tensorflow_cookbook/blob/master/04_Support_Vector_Machines/images/01_introduction.png "Linear Separator")
![Linear Separator](../images/01_introduction.png "Linear Separator")

Support Vector Machines (SVMs) are a machine learning method to separate binary classes. This is accomplished by maximizing a margin width between two classes. It is extended to allow for noise in the data, when the two classes are not explicitly linear separable. SVMs can be extended to separate non linear classes by using non-linear kernels. After this, we finish this chapter by showing how to extend these binary classifies into multi-class problems via a one-vs-all method.
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,17 @@ It is worth noting that due to the small data set and the randomness of separati

We will aim to maximize the margin width, 2/||A||, or minimize ||A||. We allow for a soft margin by having an error term in the loss function which is the max(0, 1-pred*actual).

![Linear Separator](https://github.com/nfmcclure/tensorflow_cookbook/blob/master/04_Support_Vector_Machines/images/01_introduction.png "Linear Separator")
![Linear Separator](../images/01_introduction.png "Linear Separator")

# Graph of Linear SVM

Here is a plot of the linear SVM separator of I. setosa based on petal width and sepal length.

![Linear SVM Output](https://github.com/nfmcclure/tensorflow_cookbook/blob/master/04_Support_Vector_Machines/images/02_linear_svm_loss.png "Linear SVM Output")
![Linear SVM Output](../images/02_linear_svm_loss.png "Linear SVM Output")

The accuracy is below, plotted over each iteration.

![Linear SVM Accuracy](https://github.com/nfmcclure/tensorflow_cookbook/blob/master/04_Support_Vector_Machines/images/02_linear_svm_accuracy.png "Linear SVM Accuracy")
![Linear SVM Accuracy](../images/02_linear_svm_accuracy.png "Linear SVM Accuracy")

An important observation is that while we achieve the linear separator rather quickly (100% accuracy), the loss function continues to decrease. This is because we are trying to optimize for the maximal linear separator between the two classes.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

Instead of optimizing the maximal linear separator, we change the loss function to maximize the amount of data points we can make fit in our margin. This will give us a linear regression estimation.

![Linear SVM Reg Loss](https://github.com/nfmcclure/tensorflow_cookbook/blob/master/04_Support_Vector_Machines/images/03_linear_svm_loss.png "Linear SVM Loss")
![Linear SVM Reg Loss](../images/03_linear_svm_loss.png "Linear SVM Loss")

![Linear SVM Reg Output](https://github.com/nfmcclure/tensorflow_cookbook/blob/master/04_Support_Vector_Machines/images/03_svm_regression_output.png "Linear SVM Fit")
![Linear SVM Reg Output](../images/03_svm_regression_output.png "Linear SVM Fit")
4 changes: 2 additions & 2 deletions 04_Support_Vector_Machines/04_Working_with_Kernels/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ Linear SVMs are very powerful. But sometimes the data are not very linear. To

If we attempt to separate the below circular-ring shaped classes with a standard linear SVM, we fail.

![Linear SVM Nonlinear Data](https://github.com/nfmcclure/tensorflow_cookbook/blob/master/04_Support_Vector_Machines/images/04_nonlinear_data_linear_kernel.png "Linear SVM Fit")
![Linear SVM Nonlinear Data](../images/04_nonlinear_data_linear_kernel.png "Linear SVM Fit")

But if we separate it with a Gaussian-RBF kernel, we can find a linear separator in a higher dimension that works a lot better.

![Gaussian Kernel Nonlinear Data](https://github.com/nfmcclure/tensorflow_cookbook/blob/master/04_Support_Vector_Machines/images/04_linear_svm_gaussian.png "Gaussian Kernel")
![Gaussian Kernel Nonlinear Data](../images/04_linear_svm_gaussian.png "Gaussian Kernel")
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

Here we show how to use the prior Gaussian RBF kernel to predict I.setosa from the Iris dataset.

![Nonlinear SVM](https://github.com/nfmcclure/tensorflow_cookbook/blob/master/04_Support_Vector_Machines/images/05_non_linear_svms.png "Nonlinear SVM")
![Nonlinear SVM](../images/05_non_linear_svms.png "Nonlinear SVM")
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

Here, we implement a 1-vs-all voting method for a multiclass SVM. We attempt to separate the three Iris flower classes with TensorFlow.

![Multiclass SVM](https://github.com/nfmcclure/tensorflow_cookbook/blob/master/04_Support_Vector_Machines/images/06_multiclass_svm.png "Multiclass SVM")
![Multiclass SVM](../images/06_multiclass_svm.png "Multiclass SVM")

0 comments on commit 201c65f

Please sign in to comment.