Generate predictions for the targets associated with the rows in `X`. Parameters ---------- X : :py:class:`ndarray ` of shape `(N', M')` An array of `N'` examples to generate predictions on Returns ------- y : :py:
(self, X)
| 51 | self.parameters = {"X": X, "y": y} |
| 52 | |
| 53 | def predict(self, X): |
| 54 | """ |
| 55 | Generate predictions for the targets associated with the rows in `X`. |
| 56 | |
| 57 | Parameters |
| 58 | ---------- |
| 59 | X : :py:class:`ndarray <numpy.ndarray>` of shape `(N', M')` |
| 60 | An array of `N'` examples to generate predictions on |
| 61 | |
| 62 | Returns |
| 63 | ------- |
| 64 | y : :py:class:`ndarray <numpy.ndarray>` of shape `(N', ...)` |
| 65 | Predicted targets for the `N'` rows in `X` |
| 66 | """ |
| 67 | K = self.kernel |
| 68 | P = self.parameters |
| 69 | sim = K(P["X"], X) |
| 70 | return (sim * P["y"][:, None]).sum(axis=0) / sim.sum(axis=0) |