Beispiel #1
0
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:]))
Beispiel #2
0
        form = "&\n".join(l)

        return head + form

    def tptp2_str(self):
        l = [i.tptp2_str() for i in self.clauses]
        return "\n".join(l)


if __name__ == '__main__':
    format = "dimacs"
    outfile = None
    batch_app = None
    fix_broken_dimacs = False

    for option in pylib_io.get_options():
        if option == "-h":
            print __doc__
            sys.exit()
        elif option == "-f" or option == "--fix-broken-dimacs":
            fix_broken_dimacs = True
        elif option == "--broken-dimacs":
            format = "broken_dimacs"
        elif option == "--tptp2" or option == "--oldtptp":
            format = "tptp2"
        elif option == "--mathsat":
            format = "mathsat"
        elif option.startswith("-o"):
            outfile = option[2:]
            if outfile == "":
                sys.exit("-o needs non-empty argument")
Beispiel #3
0
import pylib_probabilities
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
Beispiel #4
0
        form = "&\n".join(l)

        return head + form

    def tptp2_str(self):
        l = [i.tptp2_str() for i in self.clauses]
        return "\n".join(l)


if __name__ == "__main__":
    format = "dimacs"
    outfile = None
    batch_app = None
    fix_broken_dimacs = False

    for option in pylib_io.get_options():
        if option == "-h":
            print __doc__
            sys.exit()
        elif option == "-f" or option == "--fix-broken-dimacs":
            fix_broken_dimacs = True
        elif option == "--broken-dimacs":
            format = "broken_dimacs"
        elif option == "--tptp2" or option == "--oldtptp":
            format = "tptp2"
        elif option == "--mathsat":
            format = "mathsat"
        elif option.startswith("-o"):
            outfile = option[2:]
            if outfile == "":
                sys.exit("-o needs non-empty argument")