Exemplo n.º 1
0
def plotposterior(samples, param_name, min=None, max=None, prior=None,
        filename=None):
    p = Plot(title='Posterior of %s' % param_name)
    density = Density([s[param_name] for s in samples], title='Posterior')
    p.append(density)
    if prior:
        priord = Function(prior, title='Prior')
        p.append(priord)
    if min is not None:
        p.xmin = min
    if max is not None:
        p.xmax = max
    p.show()
    if filename:
        p.write(filename)
Exemplo n.º 2
0
def main():
    tm_results = parse_file('with_topic_model.log')
    ntm_results = parse_file('without_topic_model.log')
    p = Plot(title="Precision/Recall for Labeled Mentions")
    p.xmin = 0
    p.xmax = 1
    p.ymin = 0
    p.ymax = 1
    p.append(Points(tm_results[0].prec_rec,
        style='lines', title='With topic model'))
    p.append(Points(ntm_results[4].prec_rec,
        style='lines', title='Without topic model'))
    p.append(Points(tm_results[14].prec_rec,
        style='lines', title='With topic model after sampling'))
    p.append(Points(ntm_results[14].prec_rec,
        style='lines', title='Without topic model after sampling'))
    p.append(Points([(tm_results[0].baseline_rec,
        tm_results[0].baseline_prec)],
        title='Baseline performance'))
    p.write('prec_rec.gpi')
    p.show()