greedyBOEM = [ge+["boem"] for ge in greedyMethods]

    identBOEM =  [ge+["boem"] for ge in identMethods]
    identMethods += identBOEM

    for solvers in greedyMethods + greedyBOEM + [["sdp2l", "pivot", "boem"],
                                                 ["boem"]] + identMethods:
        #exp = Experiment(solverCmd, solvers, matrix)
        exp = Experiment(solverCmd, ["log"] + solvers, matrix)

        args.append(exp)
        ev = ChatEvaluation(exp, matrix.stripext()+".truth", golds,
                            matrix)
        args.append(ev)

    session = Session("Hogwash.Action", "action_runner", args, name=sessionName)

    deps = {}
    for expt,evalt in batch(session, 2):
            deps[evalt] = expt
    session.set_dependencies(deps)

    if not sessionBinDir.exists():
        sessionBinDir.mkdir()

    copy("bin32/chainedSolvers", sessionBinDir)

    session64BinDir = path(sessionName)/"bin64"
    if not session64BinDir.exists():
        session64BinDir.mkdir()
예제 #2
0
                                                     options)
    except KeyError:
        print("No such classifier as", options.classifier)
        sys.exit(1)

    print(sys.stderr, "training...")
    classifier.train()

    if options.check:
        print(sys.stderr, "evaluating...")
        classifier.check()
    elif options.distributed:
        print(sys.stderr, "distributed labeling...")
        args = list(izip(repeat(classifier), batch(range(len(testPoints)),
                                                   30)))
        ssn = Session("classify", "partLabel", args, name=options.distributed)
        print(sys.stderr, "session created...")

        if 0:
            sty = Sty("workingSession")
            sty.do_clear("all")
            sty.do_runlocally("")
            jobs_done = False
            while not jobs_done:
                stats = ssn.get_job_status_report()
                queued = []
                if "queued" in stats:
                    queued = stats["queued"]
                started = []
                if "started" in stats:
                    started = stats["started"]
예제 #3
0
        ["first"],
        ["best"],
        ["vote"],
        ["pivot"],
        ["boem"],
        ["first boem"],
        ["best boem"],
        ["vote boem"],
        ["pivot boem"],
        ["lazylp first"],
        ["lazylp best"],
        ["lazylp vote"],
        ["lazylp pivot"],
        ["lazylp first boem"],
        ["lazylp best boem"],
        ["lazylp vote boem"],
        ["lazylp pivot boem"],
        ["ilp"],
        ["sumsdp vote"],
        ]

    args = []
    for model in models:
        for datadir in workdir.dirs():
            if "bin" in datadir.basename():
                continue
            args.append((model, datadir.abspath()))

    ssn = Session("timingRuns", "runtask", args,
                  name=("hog%s" % workdir.basename()))
예제 #4
0
            trainPoints, testPoints, options)
    except KeyError:
        print("No such classifier as", options.classifier)
        sys.exit(1)

    print (sys.stderr, "training...")
    classifier.train()

    if options.check:
        print(sys.stderr, "evaluating...")
        classifier.check()
    elif options.distributed:
        print(sys.stderr, "distributed labeling...")
        args = list(izip(repeat(classifier),
                         batch(range(len(testPoints)), 30)))
        ssn = Session("classify", "partLabel", args, name=options.distributed)
        print(sys.stderr, "session created...")

        if 0:
            sty = Sty("workingSession")
            sty.do_clear("all")
            sty.do_runlocally("")
            jobs_done = False
            while not jobs_done:
                stats = ssn.get_job_status_report()
                queued = []
                if "queued" in stats:
                    queued = stats["queued"]
                started = []
                if "started" in stats:
                    started = stats["started"]
    greedyBOEM = [ge + ["boem"] for ge in greedyMethods]

    identBOEM = [ge + ["boem"] for ge in identMethods]
    identMethods += identBOEM

    for solvers in greedyMethods + greedyBOEM + [["sdp2l", "pivot", "boem"],
                                                 ["boem"]] + identMethods:
        #exp = Experiment(solverCmd, solvers, matrix)
        exp = Experiment(solverCmd, ["log"] + solvers, matrix)

        args.append(exp)
        ev = ChatEvaluation(exp, matrix.stripext() + ".truth", golds, matrix)
        args.append(ev)

    session = Session("Hogwash.Action",
                      "action_runner",
                      args,
                      name=sessionName)

    deps = {}
    for expt, evalt in batch(session, 2):
        deps[evalt] = expt
    session.set_dependencies(deps)

    if not sessionBinDir.exists():
        sessionBinDir.mkdir()

    copy("bin32/chainedSolvers", sessionBinDir)

    session64BinDir = path(sessionName) / "bin64"
    if not session64BinDir.exists():
        session64BinDir.mkdir()
예제 #6
0
    matrixFile = file(ddir / "matrix")
    matrix = readClMat(matrixFile)

    propFile = file(str(job.results))
    prop = readDataFile(propFile)

    res = Eval(gold=truth, prop=prop, clMat=matrix, filename=job.args[1])
    res.stats["time"] = jobTime(job)

    return res


if __name__ == "__main__":
    workdir = path(sys.argv[1])
    print "Working directory", workdir
    wbase = workdir.dirname().basename()
    ssnName = "hog" + wbase
    print "Session", ssnName
    session = Session(ssnName, read_only=True)

    args = list(session)
    evalSsn = Session("evaluateExperiments",
                      "evalTask",
                      args,
                      name="hogeval%s" % wbase)
    depDict = {}
    for evJob, expJob in izip(evalSsn, session):
        depDict[evJob] = expJob
    evalSsn.set_dependencies(depDict)
    trainPts = readDataFile(goldFile)
    truth = readDataFile(goldFile)

    matrixFile = file(ddir/"matrix")
    matrix = readClMat(matrixFile)

    propFile = file(str(job.results))
    prop = readDataFile(propFile)

    res = Eval(gold=truth, prop=prop, clMat=matrix, filename=job.args[1])
    res.stats["time"] = jobTime(job)

    return res

if __name__ == "__main__":
    workdir = path(sys.argv[1])
    print "Working directory", workdir
    wbase = workdir.dirname().basename()
    ssnName = "hog" + wbase
    print "Session", ssnName
    session = Session(ssnName, read_only=True)

    args = list(session)
    evalSsn = Session("evaluateExperiments", "evalTask", args,
                      name="hogeval%s" % wbase)
    depDict = {}
    for evJob,expJob in izip(evalSsn,session):
        depDict[evJob] = expJob
    evalSsn.set_dependencies(depDict)
    
예제 #8
0
from AIMA import DefaultDict

from DistributedExperiment import Experiment, Evaluation

def getCorpus(obj):
    return int(re.search("\d+", obj.exp.mfile.basename()).group(0))

def solverObj(solvers):
    if "log" in solvers:
        return "logObjective"
    return "objective"

if __name__ == "__main__":
    sessionName = sys.argv[1]

    ssn = Session(sessionName, read_only=True)

    evals = DefaultDict(DefaultDict([]))

    for job in ssn:
        #print job
        if job.status != "finished":
            continue
        obj = job.args[0]
        if isinstance(obj, Evaluation):
            corpus = getCorpus(obj)
            solvers = tuple(obj.exp.solvers)
            evals[corpus][solvers].append(job.results)

    avgBest = DefaultDict([])
    avgAvg = DefaultDict([])
예제 #9
0
    else:
        color = "k"

    if "boem" in modelStr:
        sym = "."
    else:
        sym = ""

    return color+sym+line

if __name__ == "__main__":
    workdir = path(sys.argv[1])
    print "Working directory", workdir
    ssnName = "hog" + workdir.dirname().basename()
    print "Session", ssnName
    session = Session(ssnName, read_only=True)
    evalSsnName = "hogeval" + workdir.dirname().basename()
    print "Eval session", evalSsnName
    evalSsn = Session(evalSsnName, read_only=True)

    plotStat = "time"

    modelSeqs = DefaultDict([])

    for ct,job in enumerate(evalSsn):
        if ct % 20 == 0:
            print ct, "..."
        
        if job.status == "finished":
            res = job.results