Ejemplo n.º 1
0
def mk_test_graphs(hconf, dconf):
    "Generate graphs for test data"
    econf = hconf.test_evaluation
    if econf is None:
        return
    with Torpor('creating test graphs'):
        edus = concat_l(dpack.edus for dpack in dconf.pack.values())
        gold = to_predictions(dconf.pack)
        _mk_econf_graphs(hconf, edus, gold, econf, None)
Ejemplo n.º 2
0
def mk_test_graphs(hconf, dconf):
    "Generate graphs for test data"
    econf = hconf.test_evaluation
    if econf is None:
        return
    with Torpor('creating test graphs'):
        edus = concat_l(dpack.edus for dpack in dconf.pack.values())
        gold = to_predictions(dconf.pack)
        _mk_econf_graphs(hconf, edus, gold, econf, None)
Ejemplo n.º 3
0
def mk_graphs(hconf, dconf):
    "Generate graphs for the gold data and for one of the folds"
    with Torpor('creating gold graphs'):
        _mk_gold_graphs(hconf, dconf)
    fold = sorted(set(dconf.folds.values()))[0]

    with Torpor('creating graphs for fold {}'.format(fold), sameline=False):
        test_pack = select_testing(dconf.pack, dconf.folds, fold)
        edus = concat_l(dpack.edus for dpack in test_pack.values())
        gold = to_predictions(test_pack)
        jobs = []
        for econf in hconf.detailed_evaluations:
            jobs.extend(_mk_econf_graphs(hconf, edus, gold, econf, fold))
        Parallel(n_jobs=hconf.runcfg.n_jobs, verbose=True)(jobs)
Ejemplo n.º 4
0
def _mk_gold_graphs(hconf, dconf):
    "Generate graphs for a single configuration"
    # output path
    output_dir = fp.join(hconf.report_dir_path(None), 'graphs-gold')

    settings =\
        GraphSettings(hide=None,
                      select=hconf.graph_docs,
                      unrelated=False,
                      timeout=15,
                      quiet=True)

    predictions = to_predictions(dconf.pack)
    edus = concat_l(dpack.edus for dpack in dconf.pack.values())
    graph_all(edus, predictions, settings, output_dir)
Ejemplo n.º 5
0
def mk_graphs(hconf, dconf):
    "Generate graphs for the gold data and for one of the folds"
    with Torpor('creating gold graphs'):
        _mk_gold_graphs(hconf, dconf)
    fold = sorted(set(dconf.folds.values()))[0]

    with Torpor('creating graphs for fold {}'.format(fold),
                sameline=False):
        test_pack = select_testing(dconf.pack, dconf.folds, fold)
        edus = concat_l(dpack.edus for dpack in test_pack.values())
        gold = to_predictions(test_pack)
        jobs = []
        for econf in hconf.detailed_evaluations:
            jobs.extend(_mk_econf_graphs(hconf, edus, gold, econf, fold))
        hconf.parallel(jobs)
Ejemplo n.º 6
0
def mk_graphs(lconf, dconf):
    "Generate graphs for the gold data and for one of the folds"
    with Torpor('creating gold graphs'):
        _mk_gold_graphs(lconf, dconf)
    fold = sorted(set(dconf.folds.values()))[0]

    with Torpor('creating graphs for fold {}'.format(fold),
                sameline=False):
        test_pack = select_testing(dconf.pack, dconf.folds, fold)
        edus = concat_l(dpack.edus for dpack in test_pack.values())
        gold = to_predictions(test_pack)
        jobs = []
        for econf in DETAILED_EVALUATIONS:
            jobs.extend(_mk_econf_graphs(lconf, edus, gold, econf, fold))
        Parallel(n_jobs=-1)(jobs)
Ejemplo n.º 7
0
def _mk_gold_graphs(hconf, dconf):
    "Generate graphs for a single configuration"
    # output path
    output_dir = fp.join(hconf.report_dir_path(None),
                         'graphs-gold')

    settings =\
        GraphSettings(hide=None,
                      select=hconf.graph_docs,
                      unrelated=False,
                      timeout=15,
                      quiet=True)

    predictions = to_predictions(dconf.pack)
    edus = concat_l(dpack.edus for dpack in dconf.pack.values())
    graph_all(edus, predictions, settings, output_dir)
Ejemplo n.º 8
0
def _evaluations():
    "the evaluations we want to run"
    # non-prob mst decoder (dp learners don't do probs)
    nonprob_mst = MstDecoder(MstRootStrategy.fake_root, False)
    #
    learners = []
    learners.extend(_LOCAL_LEARNERS)
    learners.extend(l(nonprob_mst) for l in _STRUCTURED_LEARNERS)
    ipairs = list(itr.product(learners, _INTRA_INTER_CONFIGS))
    res = concat_l([
        concat_l(_core_parsers(l) for l in learners),
        concat_l(_mk_basic_intras(l, x) for l, x in ipairs),
        concat_l(_mk_sorc_intras(l, x) for l, x in ipairs),
        concat_l(_mk_dorc_intras(l, x) for l, x in ipairs),
        concat_l(_mk_last_intras(l, x) for l, x in ipairs),
    ])
    return [x for x in res if not _is_junk(x)]
Ejemplo n.º 9
0
def _evaluations():
    "the evaluations we want to run"
    # non-prob mst decoder (dp learners don't do probs)
    nonprob_mst = Keyed('', MstDecoder(MstRootStrategy.fake_root, False))
    nonprob_mst = tc_decoder(nonprob_mst)
    nonprob_mst = nonprob_mst.payload
    #
    learners = []
    learners.extend(_LOCAL_LEARNERS)
    learners.extend(l(nonprob_mst) for l in _STRUCTURED_LEARNERS)
    ipairs = list(itr.product(learners, _INTRA_INTER_CONFIGS))
    res = concat_l([
        concat_l(_core_parsers(l) for l in learners),
        concat_l(_mk_basic_intras(l, x) for l, x in ipairs),
        concat_l(_mk_sorc_intras(l, x) for l, x in ipairs),
        concat_l(_mk_dorc_intras(l, x) for l, x in ipairs),
        concat_l(_mk_last_intras(l, x) for l, x in ipairs),
    ])
    return [x for x in res if not _is_junk(x)]