Esempio n. 1
0
def plotmixing(samples, param_name, filename=None):
    p = Plot(title='%s mixing plot' % param_name)
    points = Points([(i,s[param_name]) for i,s in enumerate(samples)],
            style='lines')
    points.linewidth=1
    p.append(points)
    p.show()
    if filename:
        p.write(filename)
Esempio n. 2
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)
Esempio n. 3
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()
Esempio n. 4
0
if not args:
    parser.error('Log file not specified.')

plot = Plot()
plot.ylogscale = 10
plot.xlabel = 'Function Evaluations'
plot.ylabel = 'Best Function Value'

for filename in args:
    data = PSOData(open(filename))
    trim = int(len(data) / 10)
    points = []
    bars = []
    iterations = len(data[0])
    samples_step = int(math.ceil(iterations / MAX_SAMPLES))
    bar_samples_step = int(math.ceil(iterations / MAX_BAR_SAMPLES))
    for iteration in islice(data[0], 0, None, samples_step):
        points.append((iteration, data.average(iteration)))
    for iteration in islice(data[0], 0, None, bar_samples_step):
        low, med, high = data.statistics(iteration, trim)
        bars.append((iteration, med, low, high))
    plot.append(Points(points, title=filename, style='lines'))
    plot.append(RawData(bars, style='errorbars'))

plot.show()

if opts.print_page:
    plot.print_page()

# vim: et sw=4 sts=4