July 2017
Intermediate to advanced
360 pages
8h 26m
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_classification>>> nb_samples = 500>>> X, Y = make_classification(n_samples=nb_samples, n_features=2, n_informative=2, n_redundant=0, n_clusters_per_class=1)
In the following figure, 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 is a very efficient ...
Read now
Unlock full access