Esempio n. 1
0
 def init_args_list(self, input_dict):                 
     args_list = [os.path.join(os.path.dirname(os.path.abspath(__file__)),os.path.join('bin','1BC.exe' if os.name == 'nt' else '1BC')), '-r', 'INDIVIDUAL' if self.is1BC2 else 'LANGUAGE']
     args_list += ['-roc']
     args_list += ['-m', '512']
 
     try:
         max_literal = int(input_dict['max_literal'])
     except ValueError:
         raise Exception('Max Literal should be an integer')
     
     try:
         max_variable = int(input_dict['max_variable'])
     except ValueError:
         raise Exception('Max Variable should be an integer')
            
     try:
         cross_number = int(input_dict['cross_number'])
     except ValueError:
         pass
     else:
         if cross_number >= 1:
             args_list += ['-cross', str(cross_number)]
         
     try:
         srand = int(input_dict['srand'])
     except ValueError:
         pass
     else:
         args_list += ['-srand', str(srand)]
         
     try:
         roc_nb_folds = int(input_dict['roc_nb_folds'])
     except ValueError:
         pass
     else:
         if roc_nb_folds >= 0:
             args_list += ['-o', str(roc_nb_folds)]   
             
     if input_dict['load_part_inc']:
         args_list += ['-i']                 
 
     att_list = helper.create_attribute_list(input_dict['attribute_list'])
     if att_list:
         args_list += att_list   
   
     args_list += ['class']
     
     args_list += [str(max_literal) + '/' + str(max_variable), os.path.relpath(self.url, os.path.dirname(os.path.abspath(__file__)))]    
     
     return args_list
Esempio n. 2
0
File: onebc.py Progetto: Alshak/rdm
 def init_args_list(self, input_dict):                 
     args_list = [os.path.join(os.path.dirname(os.path.abspath(__file__)),os.path.join('bin','1BC.exe' if os.name == 'nt' else '1BC')), '-r', 'INDIVIDUAL' if self.is1BC2 else 'LANGUAGE']
     args_list += ['-roc']
     args_list += ['-m', '512']
 
     try:
         max_literal = int(input_dict['max_literal'])
     except ValueError:
         raise Exception('Max Literal should be an integer')
     
     try:
         max_variable = int(input_dict['max_variable'])
     except ValueError:
         raise Exception('Max Variable should be an integer')
            
     try:
         cross_number = int(input_dict['cross_number'])
     except ValueError:
         pass
     else:
         args_list += ['-cross', str(cross_number)]
         
     try:
         srand = int(input_dict['srand'])
     except ValueError:
         pass
     else:
         args_list += ['-srand', str(srand)]
         
     try:
         roc_nb_folds = int(input_dict['roc_nb_folds'])
     except ValueError:
         pass
     else:
         if roc_nb_folds >= 0:
             args_list += ['-o', str(roc_nb_folds)]   
             
     if input_dict['load_part_inc']:
         args_list += ['-i']                 
 
     att_list = helper.create_attribute_list(input_dict['attribute_list'])
     if att_list:
         args_list += att_list   
   
     args_list += ['class']
     
     args_list += [str(max_literal) + '/' + str(max_variable), os.path.relpath(self.url, os.path.dirname(os.path.abspath(__file__)))]    
     
     return args_list
Esempio n. 3
0
    def init_args_list(self, input_dict):
        args_list = [
            os.path.join(
                os.path.dirname(os.path.abspath(__file__)),
                os.path.join('bin',
                             'tertius.exe' if os.name == 'nt' else 'tertius'))
        ]
        args_list += ['-m', '512']

        try:
            max_literal = int(input_dict['max_literal'])
        except ValueError:
            raise Exception('Max Literal should be an integer')

        try:
            max_variable = int(input_dict['max_variable'])
        except ValueError:
            raise Exception('Max Variable should be an integer')

        try:
            struct_nb_properties = int(input_dict['struct_nb_properties'])
        except ValueError:
            pass
        else:
            if struct_nb_properties >= 0:
                args_list += ['-struct', str(struct_nb_properties)]

        try:
            nb_results = int(input_dict['nb_results'])
        except ValueError:
            nb_results = -1
        else:
            if nb_results > 0:
                args_list += ['-k', str(nb_results)]

        if nb_results < 0:
            try:
                conf_thres = int(input_dict['conf_thres'])
            except ValueError:
                conf_thres = -1
            else:
                if conf_thres > 0:
                    args_list += ['-c', str(conf_thres)]

        if input_dict['count_bottom_up']:
            args_list += ['-cbu']

        if input_dict['sat_clauses']:
            args_list += ['-sat']

        try:
            noise_percent_thres = float(input_dict['noise_percent_thres'])
        except ValueError:
            pass
        else:
            if noise_percent_thres >= 0:
                args_list += ['-n', str(noise_percent_thres)]

        if str(input_dict['lang_bias']) == 'horn':
            args_list += ['-b', 'horn']
        elif str(input_dict['lang_bias']) == 'pos_horn_class':
            args_list += ['-b', 'pos_horn_class']
        elif str(input_dict['lang_bias']) == 'pos_class':
            args_list += ['-b', 'pos_class']
        elif str(input_dict['lang_bias']) == 'class':
            args_list += ['-b', 'class']

        att_list = helper.create_attribute_list(input_dict['attribute_list'])
        if att_list:
            args_list += att_list

        args_list += [
            str(max_literal) + '/' + str(max_variable),
            os.path.relpath(self.url,
                            os.path.dirname(os.path.abspath(__file__)))
        ]

        return args_list
Esempio n. 4
0
 def init_args_list(self, input_dict):           
     args_list = [os.path.join(os.path.dirname(os.path.abspath(__file__)),os.path.join('bin','tertius.exe' if os.name == 'nt' else 'tertius'))]
     args_list += ['-m', '512']
     
     try:
         max_literal = int(input_dict['max_literal'])
     except ValueError:
         raise Exception('Max Literal should be an integer')
     
     try:
         max_variable = int(input_dict['max_variable'])
     except ValueError:
         raise Exception('Max Variable should be an integer')
 
     try:
         struct_nb_properties = int(input_dict['struct_nb_properties'])
     except ValueError:
         pass
     else:
         if struct_nb_properties >= 0:
             args_list += ['-struct', str(struct_nb_properties)]   
 
     try:
         nb_results = int(input_dict['nb_results'])
     except ValueError:
         nb_results = -1
     else:
         if nb_results > 0:
             args_list += ['-k', str(nb_results)]   
          
     if nb_results < 0:
         try:
             conf_thres = int(input_dict['conf_thres'])
         except ValueError:
             conf_thres = -1
         else:
             if conf_thres > 0:
                 args_list += ['-c', str(conf_thres)]   
                 
     if input_dict['count_bottom_up']:
         args_list += ['-cbu']                       
 
     if input_dict['sat_clauses']:
         args_list += ['-sat'] 
         
     try:
         noise_percent_thres = float(input_dict['noise_percent_thres'])
     except ValueError:
         pass
     else:
         if noise_percent_thres >= 0:
             args_list += ['-n', str(noise_percent_thres)]   
             
     if str(input_dict['lang_bias']) == 'horn':
         args_list += ['-b', 'horn']   
     elif str(input_dict['lang_bias']) == 'pos_horn_class':
         args_list += ['-b', 'pos_horn_class']   
     elif str(input_dict['lang_bias']) == 'pos_class':
         args_list += ['-b', 'pos_class']   
     elif str(input_dict['lang_bias']) == 'class':
         args_list += ['-b', 'class']
                            
     att_list = helper.create_attribute_list(input_dict['attribute_list'])
     if att_list:
         args_list += att_list  
                             
     args_list += [str(max_literal) + '/' + str(max_variable),os.path.relpath(self.url, os.path.dirname(os.path.abspath(__file__)))]
     
     return args_list