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)
| 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): |
no test coverage detected