Exemplo n.º 1
0
def compare(name, structure):
    # if name == 'c20ng' and structure == 'tree':
    #    return
    rlist = []
    rname = "results/%s/%s.%s" % (dirname, name, structure)
    ename = "results/%s/error.%s.%s" % (dirname, name, structure)
    try:
        if os.path.isfile(rname + ".pkl") and os.path.isfile(rname + ".csv"):
            print "skipping ", rname
            return
        br = gs.best_grid_point(name, structure, "grid")
        t = float(br["t"])
        cp = float(br["cp"])
        for i in range(10):
            print i, name
            r = gs.eval_grid_point(structure, name, t, cp, 1)
            rlist.append(r)
    except Exception as e:
        print "compare() caught exception: something went wrong"  # at i:%d'%i
        experiment.save_results(rlist, ename)
        import traceback

        traceback.print_exc(file=open(ename + ".tb", "w"))
        raise
    else:
        experiment.save_results(rlist, rname)
Exemplo n.º 2
0

def t_tests():
    print "name\t\tdag_tst\t\t", "tree_tst\t", "dag > tree\t", " dsize", "tsize\t", "|ds|/|ts|", "dtime\t\t", "ttime\t", "dt/tt"
    for name in names:
        t_test(name)


if False:
    pool = Pool(5)
    structure = "tree"
    tasks = [(n, structure) for n in names]
    results = [pool.apply_async(compare, t) for t in tasks]
    for r in results:
        r.get()

    pool.close()
    pool.join()
elif True:
    t_tests()
else:
    for structure in ["dag", "tree"]:
        print "\n\t\t\ttime\tvld_llh\t\t\tnum_nodes"
        for name in names:
            if name == "c20ng":
                continue
            br = gs.best_grid_point(name, structure, "grid")
            print (name + "          ")[:8], "\t", structure, "\t", int(float(br["time"])), "\t", br[
                "vld_llh"
            ], "\t", br["num_nodes"]