MCPcopy Create free account
hub / github.com/ddbourgin/numpy-ml / __init__

Method __init__

numpy_ml/utils/kernels.py:73–94  ·  view source on GitHub ↗

The linear (i.e., dot-product) kernel. Notes ----- For input vectors :math:`\mathbf{x}` and :math:`\mathbf{y}`, the linear kernel is: .. math:: k(\mathbf{x}, \mathbf{y}) = \mathbf{x}^\\top \mathbf{y} + c_0 Parameters --

(self, c0=0)

Source from the content-addressed store, hash-verified

71
72class LinearKernel(KernelBase):
73 def __init__(self, c0=0):
74 """
75 The linear (i.e., dot-product) kernel.
76
77 Notes
78 -----
79 For input vectors :math:`\mathbf{x}` and :math:`\mathbf{y}`, the linear
80 kernel is:
81
82 .. math::
83
84 k(\mathbf{x}, \mathbf{y}) = \mathbf{x}^\\top \mathbf{y} + c_0
85
86 Parameters
87 ----------
88 c0 : float
89 An "inhomogeneity" parameter. When `c0` = 0, the kernel is said to be
90 homogenous. Default is 1.
91 """
92 super().__init__()
93 self.hyperparameters = {"id": "LinearKernel"}
94 self.parameters = {"c0": c0}
95
96 def _kernel(self, X, Y=None):
97 """

Callers

nothing calls this directly

Calls 1

__init__Method · 0.45

Tested by

no test coverage detected