Exemplo n.º 1
0
def run(cross=True, verbose=False, xml="../xml/RTE2_dev.xml", pre_processec_xml="../xml/RTE2_dev.preprocessed.xml"):
    learning_data="learningdata.tab" # the data features. extracted from an earlier run of features.
    filename = "results_part3.txt"
    clean_file(filename)
    if cross: features.run(xml, pre_processec_xml) # extracts the features
    data = orange.ExampleTable(learning_data)
    l = orange.BayesLearner(data)
    if cross:
        if verbose:
            print "result: ", validation(data)
            for item in data:
                if item.getclass() != l(item):
                    print '\033[1;41m'
                    print item, l(item),
                    print '\033[1;m'
                    print
                else:
                    print item, l(item)
        else:
            print "result: ", validation(data)
    else:
        file = open(filename, "a")
        file.write("ranked: no\n")
        if file:
            for item in data:
                s = str(item['id']) +" "+ str(l(item))
                file.write(s+"\n")
        else:
            print "Error opening file"
        file.close()
        print "finished writing to results_part3"

#run(True, False, "../xml/blind-test-data.xml") # runs the learning
#run(False) # runs the writing to results file.
Exemplo n.º 2
0
    if cfg.quick == True:
        g.run(cfg.name, quick = True)
    else:
        g.run(cfg.name)

if cfg.roc == True:
    import roccurves as rc
    if cfg.quick == True:
        rc.run(cfg.name + str(cfg.maxdepth), quick = True)
    else:
        rc.run(cfg.name + str(cfg.maxdepth))
    
if cfg.features == True:
    import features as f
    if cfg.quick == True:
        f.run(cfg.name + str(cfg.maxdepth), quick = True)
    else:
        f.run(cfg.name + str(cfg.maxdepth))
        
if cfg.checksignal == True:
    import checksignal as cs
    if cfg.quick == True:
        cs.run(cfg.name + str(cfg.maxdepth), quick = True)
    else:
        cs.run(cfg.name + str(cfg.maxdepth))

if cfg.crossvalidation == True:
    import crossvalidation as cv
    if cfg.quick == True:
        cv.run(cfg.name + str(cfg.maxdepth), quick = True)
    else: