MCPcopy Create free account
hub / github.com/TheAlgorithms/Python / __init__

Method __init__

machine_learning/sequential_minimum_optimization.py:405–411  ·  view source on GitHub ↗
(self, kernel, degree=1.0, coef0=0.0, gamma=1.0)

Source from the content-addressed store, hash-verified

403
404class Kernel:
405 def __init__(self, kernel, degree=1.0, coef0=0.0, gamma=1.0):
406 self.degree = np.float64(degree)
407 self.coef0 = np.float64(coef0)
408 self.gamma = np.float64(gamma)
409 self._kernel_name = kernel
410 self._kernel = self._get_kernel(kernel_name=kernel)
411 self._check()
412
413 def _polynomial(self, v1, v2):
414 return (self.gamma * np.inner(v1, v2) + self.coef0) ** self.degree

Callers

nothing calls this directly

Calls 2

_get_kernelMethod · 0.95
_checkMethod · 0.95

Tested by

no test coverage detected