(self, threshold=0.5)
| 18 | self.confuse_matrix() |
| 19 | |
| 20 | def predict(self, threshold=0.5): |
| 21 | # 根据阈值判断正类还是负类 |
| 22 | a = np.empty(shape=np.array(self.y_predict_rate).shape) |
| 23 | for i in range(len(self.y_predict_rate)): |
| 24 | if self.y_predict_rate[i] >= threshold: a[i] = 1 |
| 25 | else: a[i] = 0 |
| 26 | self.y_predict = a |
| 27 | |
| 28 | def confuse_matrix(self): |
| 29 | # 计算混淆矩阵 |
no outgoing calls
no test coverage detected