MCPcopy Create free account
hub / github.com/Giyn/DataMiningVisualizationSystem / predict

Method predict

model_assessment/clf.py:20–26  ·  view source on GitHub ↗
(self, threshold=0.5)

Source from the content-addressed store, hash-verified

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 # 计算混淆矩阵

Callers 5

__init__Method · 0.95
paint_PRMethod · 0.95
paint_ROCMethod · 0.95
cross_validationFunction · 0.45
predictFunction · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected