Commit 86592231 authored by Anze Vavpetic's avatar Anze Vavpetic
Browse files

added target attribute value sanity check for `db to aleph`

parent 0aaf1463
......@@ -170,6 +170,10 @@ class Aleph_Converter(ILP_Converter):
if not pos_rows:
raise Exception('No positive examples with the given target attribute value, please re-check.')
self.__pos_examples = '\n'.join(['%s(%s).' % (self.__target_predicate(), id) for _, id in pos_rows])
self.__neg_examples = '\n'.join(['%s(%s).' % (self.__target_predicate(), id) for _, id in neg_rows])
return self.__pos_examples, self.__neg_examples
......@@ -32,7 +32,10 @@ def mysql_rsd_converter(input_dict):
def mysql_aleph_converter(input_dict):
dump = input_dict['dump'] == 'true'
aleph = Aleph_Converter(input_dict['context'], target_att_val=input_dict['target_att_val'], discr_intervals=input_dict['discr_intervals'] or {}, dump=dump)
target_att_val = input_dict['target_att_val']
if not target_att_val:
raise Exception('Please specify a target attribute value.')
aleph = Aleph_Converter(input_dict['context'], target_att_val=target_att_val, discr_intervals=input_dict['discr_intervals'] or {}, dump=dump)
return {'pos_examples' : aleph.positive_examples(), 'neg_examples' : aleph.negative_examples(), 'bk' : aleph.background_knowledge()}
def mysql_treeliker_converter(input_dict):
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment