Пример #1
0
    def test(self, x_test, y_test, params, n_centers, width):
        y_true = []
        y_pred = []
        (p, _) = x_test.shape
        for i in range(p):
            d = y_test[i]
            y = self.predict(x_test[i], params, n_centers, width)

            # Confusion Matrix
            y_true.append(list(d))
            y_pred.append(list(y))

        a = util.inverse_transform(y_true, self.n_classes)
        b = util.inverse_transform(y_pred, self.n_classes)
        return acc(a, b), tpr(a, b,
                              average='macro'), 0, ppv(a,
                                                       b,
                                                       average='weighted')
Пример #2
0
    def test(self, x_test, y_test):
        (m, _) = x_test.shape
        y_actu = []
        y_pred = []
        for i in range(m):
            xi = x_test[i]
            y, _ = self.predict(xi)
            d = y_test[i]

            # Confusion Matrix
            y_actu.append(list(d))
            y_pred.append(list(y))

        a = util.inverse_transform(y_actu)
        b = util.inverse_transform(y_pred)
        cm = ConfusionMatrix(a, b)
        #cm.print_stats()
        #util.plotConfusionMatrix(cm)

        return cm.ACC, cm.TPR, cm.SPC, cm.PPV