# Project: Support Vector Machines with scikit-learn

In this course, you will learn the functioning and intuition behind a powerful class of supervised linear models known as support vector machines (SVMs). You will then apply this knowledge to build SVMs for your own classification tasks. A basic familiarity of Python is assumed.

Duration (mins)

Learners

#### 5.0 / 5

Rating

We will cover the following tasks in 1 hour and 40 minutes:

### Getting Started

In this task, you will get a sense of your virtual machine, the Jupyter Notebook software, and the course material.

### Beyond Linear Discriminative Classifiers

Understand the scope of scope and limitations of linear classifiers, and how SVMs offer a way to overcome them. We will use Scikit-Learn to generate a random dataset with two linearly separable classes. Next we will try finding the best decision boundary for our data.

### Many Possible Separators

In this chapter, we will plot multiple decision boundaries that give us perfect in-sample classification. We learn why these linear models lead to poor generalization performance and how SVMs provide a way to overcome them.

### Plotting the Margins

In this chapter, we will plot margins around our three decision boundaries. We will also look at some of the mathematics and frame our constrained optimization problem in the language of quadratic programming.

### Training an SVM Model

In this chapter, we will train an SVM model with Scikit-Learn’s support vector classifier (SVC) and fit the model to our data.

### Facial Recognition with SVMs

As our first application of SVMs to real-world tasks, we begin to tackle the domain of facial recognition. In this task, we load the Labeled Faces data from the Wild dataset. Built into Scikit-Learn, this dataset consists of thousands of labeled photographs of various public figures.

### Exploring the data set

We plot some of the faces from our data to get a sense of what we are working with.

### Preprocessing the data set

In the previous task we observed that each image consists of nearly 3000 pixel values. Instead of simply using each one as a feature, we use Principal Component Analysis to extract more meaningful features which we will feed to our Support Vector Classifier.

After preprocessing our data, we split them into training and test sets.

### Grid-Search Cross Validation

In this task, we will determine the best model. To do so, we will use grid search cross-validation to determine the optimal parameters from all the possible combinations.

### Visualize Test Images

With our cross-validated model, we plot a few of the test images with their predicted labels. Remember, our model predicts labels for data that it hasn’t encountered previously during the training process.

### Evaluating the Support Vector Classifier

We evaluate our classifier’s out-of-sample performance and get the recovery statistics using the classification report. We also visualize the confusion matrix to understand which labels might be confusing our classifier.

## Watch Preview

Preview the instructions that you will follow along in a hands-on session in your browser.

## About the Host (Snehan Kekre)

Snehan Kekre is a Machine Learning and Data Science Instructor at Coursera. He studied Computer Science and Artificial Intelligence at Minerva Schools at KGI, based in San Francisco. His interests include AI safety, EdTech, and instructional design. He recognizes that building a deep, technical understanding of machine learning and AI among students and engineers is necessary in order to grow the AI safety community. This passion drives him to design hands-on, project-based machine learning courses on Rhyme.

##### How is this different from YouTube, PluralSight, Udemy, etc.?
In Rhyme, all projects are completely hands-on. You don't just passively watch someone else. You use the software directly while following the host's (Snehan Kekre) instructions. Using the software is the only way to achieve mastery. With the "Live Guide" option, you can ask for help and get immediate response.
##### Is this session really free?
Absolutely! Your host (Snehan Kekre) has provided this session completely free of cost!
##### Can I buy Rhyme sessions for my company or learning institution?
Absolutely. We offer Rhyme for workgroups as well larger departments and companies. Universities, academies, and bootcamps can also buy Rhyme for their settings. You can select projects and trainings that are mission critical for you and, as well, author your own that reflect your own needs and tech environments. Please email us at help@rhyme.com
##### What kind of accessibility options does Rhyme provide?
Rhyme strives to ensure that visual instructions are helpful for reading impairments. The Rhyme interface has features like resolution and zoom that will be helpful for visual impairments. And, we are currently developing a close-caption functionality to help with hearing impairments. Most of the accessibility options of the cloud desktop's operating system or the specific application can also be used in Rhyme. If you have questions related to accessibility, please email us at accessibility@rhyme.com
##### Why don't you just use containers or virtual browsers?
We started with windows and linux cloud desktops because they have the most flexibility in teaching any software (desktop or web). However, web applications like Salesforce can run directly through a virtual browser. And, others like Jupyter and RStudio can run on containers and be accessed by virtual browsers. We are currently working on such features where such web applications won't need to run through cloud desktops. But, the rest of the Rhyme learning, authoring, and monitoring interfaces will remain the same.
##### I have a different question
Please email us at help@rhyme.com and we'll respond to you within one business day.

## More Projects by Snehan Kekre

43 minutes
###### Classify Toxic Comments using Convolutions with Keras
1 hour and 11 minutes
42 minutes
57 minutes
41 minutes
52 minutes
###### Project: Facial Expression Recognition in Keras
1 hour and 24 minutes
###### Project: Real-Time Object Detection with YOLOv3
1 hour and 5 minutes
###### Project: Image Super Resolution using Autoencoders in Keras
1 hour and 4 minutes
53 minutes
52 minutes
###### scikit-learn: Logistic Regression for Sentiment Analysis
1 hour and 26 minutes
45 minutes
58 minutes
57 minutes
###### Predictive Analytics for Business with H2O and R
1 hour and 6 minutes
47 minutes
43 minutes
###### Create Interactive Dashboards with Streamlit and Python
1 hour and 33 minutes
50 minutes
53 minutes
###### Project: Regression Analysis with Yellowbrick
1 hour and 10 minutes
55 minutes
###### Project: Named Entity Recognition using LSTMs with Keras
1 hour and 10 minutes
47 minutes
###### Build a Machine Learning Web App with Streamlit and Python
1 hour and 21 minutes
###### Logistic Regression with NumPy and Python
1 hour and 3 minutes
47 minutes
58 minutes
###### Explainable Machine Learning with LIME and H2O in R
1 hour and 24 minutes
###### Automatic Machine Learning with H2O AutoML
1 hour and 1 minute
58 minutes
###### Build a Data Science Web App with Streamlit and Python
1 hour and 21 minutes
48 minutes
52 minutes
52 minutes
###### Project: Predict Employee Turnover with scikit-learn
1 hour and 4 minutes
###### Project: Predictive Modelling with Azure Machine Learning Studio
1 hour and 6 minutes
###### Project: Anomaly Detection in Time Series Data with Keras
1 hour and 3 minutes
59 minutes
###### Project: Generate Synthetic Images with DCGANs in Keras
1 hour and 7 minutes
###### Project: Perform Feature Analysis with Yellowbrick
1 hour and 15 minutes
52 minutes