Use the trained decision tree to classify or predict the examples in `X`. Parameters ---------- X : :py:class:`ndarray ` of shape `(N, M)` The training data of `N` examples, each with `M` features Returns ------- p
(self, X)
| 85 | self.root = self._grow(X, Y) |
| 86 | |
| 87 | def predict(self, X): |
| 88 | """ |
| 89 | Use the trained decision tree to classify or predict the examples in `X`. |
| 90 | |
| 91 | Parameters |
| 92 | ---------- |
| 93 | X : :py:class:`ndarray <numpy.ndarray>` of shape `(N, M)` |
| 94 | The training data of `N` examples, each with `M` features |
| 95 | |
| 96 | Returns |
| 97 | ------- |
| 98 | preds : :py:class:`ndarray <numpy.ndarray>` of shape `(N,)` |
| 99 | The integer class labels predicted for each example in `X` if |
| 100 | self.classifier = True, otherwise the predicted target values. |
| 101 | """ |
| 102 | return np.array([self._traverse(x, self.root) for x in X]) |
| 103 | |
| 104 | def predict_class_probs(self, X): |
| 105 | """ |