Opposite of the function to maximize Args: candidate (ndarray): candidate array to test Return: float: Wolfe's Dual result to minimize
(candidate: ndarray)
| 128 | (n,) = np.shape(classes) |
| 129 | |
| 130 | def to_minimize(candidate: ndarray) -> float: |
| 131 | """ |
| 132 | Opposite of the function to maximize |
| 133 | |
| 134 | Args: |
| 135 | candidate (ndarray): candidate array to test |
| 136 | |
| 137 | Return: |
| 138 | float: Wolfe's Dual result to minimize |
| 139 | """ |
| 140 | s = 0 |
| 141 | (n,) = np.shape(candidate) |
| 142 | for i in range(n): |
| 143 | for j in range(n): |
| 144 | s += ( |
| 145 | candidate[i] |
| 146 | * candidate[j] |
| 147 | * classes[i] |
| 148 | * classes[j] |
| 149 | * self.kernel(observations[i], observations[j]) |
| 150 | ) |
| 151 | return 1 / 2 * s - sum(candidate) |
| 152 | |
| 153 | ly_contraint = LinearConstraint(classes, 0, 0) |
| 154 | l_bounds = Bounds(0, self.regularization) |
nothing calls this directly
no outgoing calls
no test coverage detected