From 94b1403410a3cfed23f9f713669012b51702fc03 Mon Sep 17 00:00:00 2001 From: Juan Pasutti Date: Wed, 18 Sep 2024 00:50:19 -0300 Subject: [PATCH] Add doctest for Kernet _linear func --- machine_learning/sequential_minimum_optimization.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/machine_learning/sequential_minimum_optimization.py b/machine_learning/sequential_minimum_optimization.py index b0f4fd83e545..eaf307a39554 100644 --- a/machine_learning/sequential_minimum_optimization.py +++ b/machine_learning/sequential_minimum_optimization.py @@ -461,6 +461,13 @@ def _polynomial(self, v1, v2): return (self.gamma * np.inner(v1, v2) + self.coef0) ** self.degree def _linear(self, v1, v2): + """ + >>> from machine_learning.sequential_minimum_optimization import Kernel + >>> kernel = Kernel(kernel='linear') + >>> result = kernel._polynomial(np.array([1, 2]), np.array([2, 3])) + >>> int(result) == 8 + True + """ return np.inner(v1, v2) + self.coef0 def _rbf(self, v1, v2):