August 2018
Intermediate to advanced
522 pages
12h 45m
English
Our first example is based on a linear SVM, as described in the previous section. We start by creating a dummy dataset with 500 vectors subdivided into two classes:
from sklearn.datasets import make_classificationnb_samples = 500X, Y = make_classification(n_samples=nb_samples, n_features=2, n_informative=2, n_redundant=0, n_clusters_per_class=1)
In the following graph, there's a plot of our dataset. Notice that some points overlap the two main blobs. For this reason, a positive C value is needed to allow the model to capture a more complex dynamic:

Scikit-learn provides the SVC class, which ...
Read now
Unlock full access