(self, X, Y)
| 76 | return np.mean(self.predict(X) == Y) |
| 77 | |
| 78 | def confusion_matrix(self, X, Y): |
| 79 | P = self.predict(X) |
| 80 | M = np.zeros((2, 2)) |
| 81 | M[0,0] = np.sum(P[Y == 0] == Y[Y == 0]) |
| 82 | M[0,1] = np.sum(P[Y == 0] != Y[Y == 0]) |
| 83 | M[1,0] = np.sum(P[Y == 1] != Y[Y == 1]) |
| 84 | M[1,1] = np.sum(P[Y == 1] == Y[Y == 1]) |
| 85 | return M |
| 86 | |
| 87 | def get_3_misclassified(self, X, Y): |
| 88 | P = self.predict(X) |