MCPcopy Index your code
hub / github.com/TheAlgorithms/Python / _e

Method _e

machine_learning/sequential_minimum_optimization.py:180–193  ·  view source on GitHub ↗

Two cases: 1: Sample[index] is non-bound, fetch error from list: _error 2: sample[index] is bound, use predicted value minus true value: g(xi) - yi

(self, index)

Source from the content-addressed store, hash-verified

178
179 # Get error for sample
180 def _e(self, index):
181 """
182 Two cases:
183 1: Sample[index] is non-bound, fetch error from list: _error
184 2: sample[index] is bound, use predicted value minus true value: g(xi) - yi
185 """
186 # get from error data
187 if self._is_unbound(index):
188 return self._error[index]
189 # get by g(xi) - yi
190 else:
191 gx = np.dot(self.alphas * self.tags, self._K_matrix[:, index]) + self._b
192 yi = self.tags[index]
193 return gx - yi
194
195 # Calculate kernel matrix of all possible i1, i2, saving time
196 def _calculate_k_matrix(self):

Callers 3

fitMethod · 0.95
_check_obey_kktMethod · 0.95
_choose_a2Method · 0.95

Calls 1

_is_unboundMethod · 0.95

Tested by

no test coverage detected