import sys import re import string from pylib_discretize import * import pylib_io import pylib_eprots ed_opt = "--equidist" ed_optspc = ed_opt+"=" ed_spclen = len(ed_optspc); round_fun = equidist_round(10) options = pylib_io.get_options() files = pylib_io.get_args() for opt in options: if opt == "--constant": round_fun = const_round elif opt == "--prop": round_fun = prop_round elif opt == "--none": round_fun = no_round elif opt == ed_opt: round_fun = equidist_round(10) elif opt[0:ed_spclen] == ed_optspc: try: round_fun = equidist_round(int(opt[ed_spclen:])) except ValueError:
elif option.startswith("-b"): batch_app = option[2:] if batch_app == "": sys.exit("-b needs non-empty argument") else: sys.exit("Unknown option " + option) if outfile and batch_app: sys.exit("Options -o and -b are incompatible") if not outfile: outfile = "-" if not batch_app: out_fp = pylib_io.flexopen(outfile, "w") files = pylib_io.get_args() if len(files) == 0: files.append("-") for file in files: formula = prop_formula() formula.dimacs_parse(file) if batch_app: out_fp = pylib_io.flexopen(file + "." + batch_app, "w") if format == "mathsat": out_fp.write(formula.mathsat_str()) out_fp.write("\n") elif format == "tptp2": out_fp.write(formula.tptp2_str())
import pylib_dectrees relgain_limit = 0.5 entropy_compare_fun = cmp max_split = 10 crossval = 0 eval_tree = False classify = False printtree = True seed = None stratified = True feature_selection = "R" dectree_constructor = pylib_dectrees.global_decision_tree options = pylib_io.get_options() args = pylib_io.get_args() for o in options: if o[0:2] == "-g": relgain_limit = float(o[2:]) if o == "-a": entropy_compare_fun = pylib_basics.rl_lex_compare feature_selection = "A" if o[0:2] == "-s": max_split = int(float(o[2:])) if o[0:2] == "-x": try: crossval = int(float(o[2:])) except ValueError: crossval = 10 if o[0:2] == "-X":