def ks(self, labels, pred_scores): """ Compute Kolmogorov-Smirnov Parameters ---------- labels: value list. The labels of data set. pred_scores: pred_scores: value list. The predict results of model. It should be corresponding to labels each data. Returns ---------- max_ks_interval: float max value of each tpr - fpt fpr: """ if self.eval_type == consts.ONE_VS_REST: try: rs = classification_metric.KS().compute(labels, pred_scores) except: rs = [0, [0], [0], [0], [0]] # in case all labels are 0 or 1 logging.warning("all true labels are 0/1 when running ovr KS") return rs else: return classification_metric.KS().compute(labels, pred_scores)
def ks(self, labels, pred_scores): """ Compute Kolmogorov-Smirnov Parameters ---------- labels: value list. The labels of data set. pred_scores: pred_scores: value list. The predict results of model. It should be corresponding to labels each data. Returns ---------- max_ks_interval: float max value of each tpr - fpt fpr: """ return classification_metric.KS().compute(labels, pred_scores)