Exemple #1
0
    def test_skipping_classes(self):
        X, y = self.samp.custom_distribution(0, 128, [64,64,0,0,0])

        collect = {}
        for k in set(y):
            collect[k] = []
        for i, klass in enumerate(y):
            collect[klass].append(X[i])

        self.failUnless(
            sum(abs(get_proportions(collect) - numpy.array([0.5, 0.5])) < PROPORTION_ERROR_MARGIN) == 2
        )
Exemple #2
0
    def test_custom_distribution(self):
        X, y = self.samp.custom_distribution(0, 128, [94,9,19,3,3])

        collect = {}
        for k in set(y):
            collect[k] = []
        for i, klass in enumerate(y):
            collect[klass].append(X[i])

        self.failUnless(
            sum(abs(get_proportions(collect) - self.true_proportions) < PROPORTION_ERROR_MARGIN) == self.K
        )
Exemple #3
0
    def test_skipping_classes(self):
        X, y = self.samp.custom_distribution(0, 128, [64, 64, 0, 0, 0])

        collect = {}
        for k in set(y):
            collect[k] = []
        for i, klass in enumerate(y):
            collect[klass].append(X[i])

        self.failUnless(
            sum(
                abs(get_proportions(collect) -
                    numpy.array([0.5, 0.5])) < PROPORTION_ERROR_MARGIN) == 2)
Exemple #4
0
    def test_custom_distribution(self):
        X, y = self.samp.custom_distribution(0, 128, [94, 9, 19, 3, 3])

        collect = {}
        for k in set(y):
            collect[k] = []
        for i, klass in enumerate(y):
            collect[klass].append(X[i])

        self.failUnless(
            sum(
                abs(get_proportions(collect) - self.true_proportions) <
                PROPORTION_ERROR_MARGIN) == self.K)