Esempio n. 1
0
 def test_write_output_c2e_no_information_loss(self):
     out_folder = "test_files_folder"
     if not exists(out_folder):
         mkdir(out_folder)
     msg = ""
     for p in properties:
         m = {}
         d = EqualWidth(3, 0)
         d.property_folder = PARTITIONS_PATH
         d.load_class_to_entity(m, p)
         write_partition_float({}, m, {}, out_folder, p)
         lines = []
         msg = check_file_similiarity(lines, msg, out_folder, p)
     self.assertTrue(msg == "", msg)
Esempio n. 2
0
def test_cutpoints(MAX, MIN, PROPERTY_ID):
    res = True
    msg = ""
    m1 = {}
    m2 = {}
    m3 = {}
    for c in range(2, 1000):
        d = EqualWidth(c, 0)
        d.property_folder = PARTITIONS_PATH
        expected_cutpoints = {PROPERTY_ID: generate_cutpoints(MIN, MAX, c)}
        d.discretize_property_without_abstracting(m1, m2, m3, PROPERTY_ID)
        real_cutpoints = d.bins_cutpoints
        t_res, t_msg = assert_almost_equality(expected_cutpoints, real_cutpoints)
        res &= t_res
        msg += t_msg
    return msg, res