RBF: Radial Basis Function Kernel Note: for more information see: https://en.wikipedia.org/wiki/Radial_basis_function_kernel Args: vector1 (ndarray): first vector vector2 (ndarray): second vector) Returns: float: exp
(self, vector1: ndarray, vector2: ndarray)
| 83 | return np.dot(vector1, vector2) |
| 84 | |
| 85 | def __rbf(self, vector1: ndarray, vector2: ndarray) -> float: |
| 86 | """ |
| 87 | RBF: Radial Basis Function Kernel |
| 88 | |
| 89 | Note: for more information see: |
| 90 | https://en.wikipedia.org/wiki/Radial_basis_function_kernel |
| 91 | |
| 92 | Args: |
| 93 | vector1 (ndarray): first vector |
| 94 | vector2 (ndarray): second vector) |
| 95 | |
| 96 | Returns: |
| 97 | float: exp(-(gamma * norm_squared(vector1 - vector2))) |
| 98 | """ |
| 99 | return np.exp(-(self.gamma * norm_squared(vector1 - vector2))) |
| 100 | |
| 101 | def fit(self, observations: list[ndarray], classes: ndarray) -> None: |
| 102 | """ |
nothing calls this directly
no test coverage detected