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

Method __init__

model_assessment/clf.py:5–18  ·  view source on GitHub ↗

分类评估(没有预测概率无法话PR和ROC) :param y_predict: 预测结果 :param y_predict_rate: 模型得出的概率 :param y_test: 真实数据

(self, y_test, y_predict=None, y_predict_rate=None)

Source from the content-addressed store, hash-verified

3
4class clf_assessment:
5 def __init__(self, y_test, y_predict=None, y_predict_rate=None):
6 """
7 分类评估(没有预测概率无法话PR和ROC)
8 :param y_predict: 预测结果
9 :param y_predict_rate: 模型得出的概率
10 :param y_test: 真实数据
11 """
12 self.TP, self.FP, self.TN, self.FN = 0,0,0,0
13 self.y_predict = y_predict
14 self.y_test = y_test
15 self.y_predict_rate = y_predict_rate
16 if y_predict_rate is None:
17 self.predict()
18 self.confuse_matrix()
19
20 def predict(self, threshold=0.5):
21 # 根据阈值判断正类还是负类

Callers

nothing calls this directly

Calls 2

predictMethod · 0.95
confuse_matrixMethod · 0.95

Tested by

no test coverage detected