def __init__(self, cm: "metrics.ConfusionMatrix" = None, window_size=200): self.window_size = window_size self._rolling_cm = metrics.Rolling( metrics.ConfusionMatrix() if cm is None else cm, window_size=self.window_size, ) super().__init__(cm=self._rolling_cm.metric)
def revert(self, y_true, y_pred, sample_weight=1.0): for label, yt in y_true.items(): try: cm = self.data[label] except KeyError: cm = metrics.ConfusionMatrix() self.data[label] = cm cm.update(yt, y_pred[label], sample_weight) return self
def __init__(self, cm: "metrics.ConfusionMatrix" = None): self.cm = metrics.ConfusionMatrix() if cm is None else cm self.accuracy = metrics.Accuracy(cm=self.cm) self.kappa = metrics.CohenKappa(cm=self.cm) self.kappa_m = metrics.KappaM(cm=self.cm) self.kappa_t = metrics.KappaT(cm=self.cm) self.recall = metrics.Recall(cm=self.cm) self.micro_recall = metrics.MicroRecall(cm=self.cm) self.macro_recall = metrics.MacroRecall(cm=self.cm) self.precision = metrics.Precision(cm=self.cm) self.micro_precision = metrics.MicroPrecision(cm=self.cm) self.macro_precision = metrics.MacroPrecision(cm=self.cm) self.f1 = metrics.F1(cm=self.cm) self.micro_f1 = metrics.MicroF1(cm=self.cm) self.macro_f1 = metrics.MacroF1(cm=self.cm) self.geometric_mean = metrics.GeometricMean(cm=self.cm)
def __init__(self, cm: "metrics.ConfusionMatrix" = None): self.cm = metrics.ConfusionMatrix() if cm is None else cm self.pair_cm = metrics.PairConfusionMatrix(self.cm) self.matthews_corr = metrics.MatthewsCorrCoef(cm=self.cm) self.completeness = metrics.Completeness(cm=self.cm) self.homogeneity = metrics.Homogeneity(cm=self.cm) self.vbeta = metrics.VBeta(cm=self.cm) self.q0 = metrics.Q0(cm=self.cm) self.q2 = metrics.Q2(cm=self.cm) self.pt = metrics.PrevalenceThreshold(cm=self.cm) self.mutual_info = metrics.MutualInfo(cm=self.cm) self.normalized_mutual_info = metrics.NormalizedMutualInfo(cm=self.cm) self.adjusted_mutual_info = metrics.AdjustedMutualInfo(cm=self.cm) self.rand = metrics.Rand(cm=self.cm) self.adjusted_rand = metrics.AdjustedRand(cm=self.cm) self.variation_info = metrics.VariationInfo(cm=self.cm)