9.3.4.Support Vector Machine - sj50179/IBM-Data-Science-Professional-Certificate GitHub Wiki

Support Vector Machine

Imagine that you've obtained a dataset containing characteristics of thousands of human cell samples extracted from patients who were believed to be at risk of developing cancer. Analysis of the original data showed that many of the characteristics differed significantly between benign and malignant samples.

Untitled

You can use the values of these cell characteristics in samples from other patients, to give an early indication of whether a new sample might be benign or malignant.

Untitled

You can use Support Vector Machine, or SVM, as a classifier to train your model to understand patterns within the data that might show, benign or malignant cells. Once the model has been trained, it can be used to predict your new or unknown cell with rather high accuracy.

What is SVM?

  • SVM is a supervised algorithm that classifies cases by finding a separator.
  1. Mapping data to a high-dimensional feature space
  2. Finding a separator

Untitled

For example, consider the following figure, which shows the distribution of a small set of cells only based on their unit size and clump thickness.

Untitled

As you can see, the data points fall into two different categories. It represents a linearly non separable data set. The two categories can be separated with a curve but not a line. That is, it represents a linearly non separable data set, which is the case for most real world data sets.

Untitled

We can transfer this data to a higher-dimensional space, for example, mapping it to a three-dimensional space. After the transformation, the boundary between the two categories can be defined by a hyperplane. As we are now in three-dimensional space, the separator is shown as a plane. This plane can be used to classify new or unknown cases. Therefore, the SVM algorithm outputs an optimal hyperplane that categorizes new examples. Now, there are two challenging questions to consider. First, how do we transfer data in such a way that a separator could be drawn as a hyperplane? And two, how can we find the best or optimized hyperplane separator after transformation?

Untitled

Data transformation

Untitled

Question

What is the meaning of "Kernelling" in SVM?

  • Finding a hyperplane in such a way that increase the dimensionality of a dataset.
  • A function to reduce the dimensionality of a dataset in SVM.
  • Mapping data into a higher dimensional space, in such a way that can change a linearly inseparable dataset into a linearly separable dataset.

Correct

Using SVM to find the hyperplane

Untitled

Pros and cons of SVM

  • Advantages:
    • Accurate in high-dimensional splaces
    • Memory efficient
  • Disadvantages:
    • Prone to over-fitting
    • No probability estimation
    • Small datasets

SVM applications

  • Image recognition
  • Text category assignment
  • Detecting spam
  • Sentiment analysis
  • Gene Expression Classification
  • Regression, outlier detection and clustering