'Number of Support vectors in SVM

How do I print the number of support vectors for a particular SVM model? Please suggest a code snippet in Python.

from sklearn.multiclass import OneVsRestClassifier

x, y = make_classification(n_samples=1000, n_features=10, n_informative=5,
                           n_redundant=5, n_classes=3, random_state=1)
model = SVC()
ovr = OneVsRestClassifier(model)
ovr.fit(x, y)
ovr.support_vectors_

the last line prints out all the support vectors, but not the number of support vectors.



Solution 1:[1]

use len()

len(ovr.support_vectors_)

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 snakecharmerb