Exemplo n.º 1
0
    def setUp(self):
        self.concept_class = Mock()
        self.representation_class = [(0, 1, 1)]
        selection_size = 5

        self.performance_oracle = PerformanceOracle(self.concept_class, self.representation_class,
                                                    selection_size)
Exemplo n.º 2
0
def test_performance_with_tolerance(length):
    concept_class = MonotoneConjunction(length)

    performance = PerformanceOracle(concept_class, 100)
    performance_with_tolerance = PerformanceOracleWithTolerance(concept_class, 0)

    random_func = tuple([choice([0, 1]) for _ in xrange(length)])
    print performance.get_estimated_performance(random_func)
    print performance_with_tolerance.get_estimated_performance(random_func)
    print
Exemplo n.º 3
0
def test_performance_with_tolerance(length):
    concept_class = MonotoneConjunction(length)

    performance = PerformanceOracle(concept_class, 100)
    performance_with_tolerance = PerformanceOracleWithTolerance(
        concept_class, 0)

    random_func = tuple([choice([0, 1]) for _ in xrange(length)])
    print performance.get_estimated_performance(random_func)
    print performance_with_tolerance.get_estimated_performance(random_func)
    print
Exemplo n.º 4
0
class TestPerformanceOracle(unittest.TestCase):
    def setUp(self):
        self.concept_class = Mock()
        self.representation_class = [(0, 1, 1)]
        selection_size = 5

        self.performance_oracle = PerformanceOracle(self.concept_class, self.representation_class,
                                                    selection_size)

    def test_simple_perf(self):

        self.concept_class.is_function_answering_yes_on_sample.side_effect = [True, True, False, False, True, False,
                                                                              False, True, True, False]

        representation = [1, 0, 0]

        self.assertEqual(0.4, self.performance_oracle.get_estimated_performance(representation))