Skip to content

Commit 2590c34

Browse files
author
Juan Pasutti
committed
Add doctest for _is_support
1 parent 0f0eb95 commit 2590c34

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

machine_learning/sequential_minimum_optimization.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -413,6 +413,13 @@ def _is_unbound(self, index):
413413
return bool(0.0 < self.alphas[index] < self._c)
414414

415415
def _is_support(self, index):
416+
"""
417+
>>> from machine_learning.sequential_minimum_optimization import SmoSVM, Kernel
418+
>>> kernel = Kernel(kernel='linear')
419+
>>> svm = SmoSVM(np.array([[1, 2, 3], [-1, -2, -3]]), kernel)
420+
>>> svm._is_support(1)
421+
False
422+
"""
416423
return bool(self.alphas[index] > 0)
417424

418425
@property

0 commit comments

Comments
 (0)