示例#1
0
    def test_mostly_mixed(self):
        mostly_black_to_black = analysis.log_likelihood(self.mixed_partition,
                                                        self.black_group,
                                                        self.mostly_black_id)
        mostly_black_to_white = analysis.log_likelihood(self.mixed_partition,
                                                        self.white_group,
                                                        self.mostly_black_id)
        mostly_white_to_white = analysis.log_likelihood(self.mixed_partition,
                                                        self.white_group,
                                                        self.mostly_white_id)
        mostly_white_to_black = analysis.log_likelihood(self.mixed_partition,
                                                        self.black_group,
                                                        self.mostly_white_id)

        assert_approx_equal(mostly_black_to_black, mostly_white_to_white)
        assert_approx_equal(mostly_black_to_white, mostly_white_to_black)
        self.assertTrue(mostly_black_to_black > mostly_black_to_white)
示例#2
0
    def test_solid_images_uniform(self):
        black_to_black = analysis.log_likelihood(self.uniform_partition,
                                                 self.black_group,
                                                 self.black_id)
        black_to_white = analysis.log_likelihood(self.uniform_partition,
                                                 self.white_group,
                                                 self.black_id)
        white_to_white = analysis.log_likelihood(self.uniform_partition,
                                                 self.white_group,
                                                 self.white_id)
        white_to_black = analysis.log_likelihood(self.uniform_partition,
                                                 self.black_group,
                                                 self.white_id)

        assert_approx_equal(black_to_black, white_to_white)
        assert_approx_equal(black_to_white, white_to_black)
        self.assertTrue(black_to_black > black_to_white)
示例#3
0
    def test_grey_images_mixed(self):
        light_grey_to_black = analysis.log_likelihood(self.mixed_partition,
                                                      self.black_group,
                                                      self.light_grey_id)
        light_grey_to_white = analysis.log_likelihood(self.mixed_partition,
                                                      self.white_group,
                                                      self.light_grey_id)
        dark_grey_to_white = analysis.log_likelihood(self.mixed_partition,
                                                     self.white_group,
                                                     self.dark_grey_id)
        dark_grey_to_black = analysis.log_likelihood(self.mixed_partition,
                                                     self.black_group,
                                                     self.dark_grey_id)

        assert_approx_equal(light_grey_to_black, dark_grey_to_white, significant=5)
        assert_approx_equal(light_grey_to_white, dark_grey_to_black, significant=5)
        self.assertTrue(light_grey_to_white > light_grey_to_black)