Example #1
0
 def test_find_best_char_literal_3(self):
     df = pd.read_csv('tests/test_files/testfile_3.csv',
                      encoding='utf-8',
                      delimiter=';')
     ds = DictDataset(1, df)
     best_l, best_foil = ds.find_best_literal(0, 0, df['Sex'].unique(),
                                              'Sex')
     self.assertEqual(9.38889, round(best_foil, 5))
     self.assertEqual("Sex in ['Female']", best_l.to_string())
Example #2
0
 def test_find_best_num_literal_3(self):
     df = pd.read_csv('tests/test_files/testfile_3.csv',
                      encoding='utf-8',
                      delimiter=';')
     ds = DictDataset(1, df)
     best_l, best_foil = ds.find_best_literal(0, 0, df['Age'].unique(),
                                              'Age')
     self.assertEqual(10, round(best_foil, 5))
     self.assertEqual('Age > 88', best_l.to_string())
Example #3
0
 def test_find_best_char_literal_2(self):
     df = pd.read_csv('tests/test_files/testfile_2.csv',
                      encoding='utf-8',
                      delimiter=';')
     ds = DictDataset(1, df)
     best_l, best_foil = ds.find_best_literal(0, 0,
                                              df['ClassOfSeat'].unique(),
                                              'ClassOfSeat')
     self.assertEqual(9, round(best_foil, 5))
     self.assertEqual("ClassOfSeat in ['1st', '3rd', 'Crew']",
                      best_l.to_string())