def report_predstats(id_discdds, id_subset, id_distances, records): r = Report('predistats-%s-%s' % (id_discdds, id_subset)) r.data('records', records) f = r.figure() colors = list(islice(cycle(['r', 'g', 'b', 'k', 'y', 'm']), 50)) delta = records['delta'] W = 0.2 # Save the raw values for i, id_d in enumerate(id_distances): r.data(id_d, records[id_d]) with f.plot('values_order', **dp_predstats_fig) as pylab: ax = pylab.subplot(111) for i, id_d in enumerate(id_distances): distance = records[id_d] distance_order = scale_score(distance) / (float(distance.size) - 1) step = float(i) / max(len(id_distances) - 1, 1) xstep = W * 2 * (step - 0.5) fancy_error_display(ax, delta + xstep, distance_order, colors[i], perc=10, label=id_d) ieee_spines(pylab) ticks = sorted(list(set(list(delta)))) pylab.xlabel('interval length') pylab.ylabel('normalized distance') pylab.xticks(ticks, ticks) pylab.yticks((0, 1), (0, 1)) pylab.axis((0.5, 0.5 + np.max(delta), -0.024, 1.2)) legend_put_below(ax) with f.plot('values', **dp_predstats_fig) as pylab: ax = pylab.subplot(111) for i, id_d in enumerate(id_distances): distance = records[id_d] step = float(i) / max(len(id_distances) - 1, 1) xstep = W * 2 * (step - 0.5) fancy_error_display(ax, delta + xstep, distance, colors[i], perc=10, label=id_d) ieee_spines(pylab) ticks = sorted(list(set(list(delta)))) pylab.xlabel('interval length') pylab.ylabel('distance') pylab.xticks(ticks, ticks) # pylab.yticks((0, 1), (0, 1)) a = pylab.axis() pylab.axis((0.5, 0.5 + np.max(delta), -0.024, a[3])) legend_put_below(ax) return r
def report_uncert_stats(records, id_ddss): # records = stats['records'] r = Report('uncert-statsall') r.data('records', records) f = r.figure() id_distances = ['L2', 'L2w'] colors = list(islice(cycle(['r', 'g', 'b', 'k', 'y', 'm']), 50)) perc = 10 W = 0.2 with f.plot('distance', **dp_predstats_fig) as pylab: ax = pylab.subplot(111) for i, id_dds in enumerate(id_ddss): which = records['id_discdds'] == id_dds delta = records[which]['delta'] distance = records[which]['L2w'] if i == 0: distance0 = records[which]['L2'] step = float(0) / max(len(id_distances) - 1, 1) xstep = W * 2 * (step - 0.5) fancy_error_display(ax, delta + xstep, distance0, colors[0], perc=perc, label='L2') step = float(i + 1) / max(len(id_distances) - 1, 1) xstep = W * 2 * (step - 0.5) fancy_error_display(ax, delta + xstep, distance, colors[i + 1], perc=perc, label='L2w' + id_dds) legend_put_below(ax) return r
def report_stats(records, id_ddss, id_streams, id_distances): r = Report('precision-stats') r.data('records', records) colors = list(islice(cycle(['r', 'g', 'b', 'k', 'y', 'm']), 50)) perc = 10 W = 0.2 for i, id_dds in enumerate(id_ddss): r.text('dds%s' % i, id_dds) streams_sets = generate_stream_sets(id_streams) for stream_set, id_distance in itertools.product(streams_sets, id_distances): f = r.figure(cols=2) with f.plot('distance_legend', caption='Streams: %s, Distance: %s' % (stream_set['label'], id_distance), **dp_predstats_fig) as pylab: ax = pylab.subplot(111) for i, id_dds in enumerate(id_ddss): which = (records['id_discdds'] == id_dds).astype('int') for id_stream in stream_set['id_streams']: which += (records['id_stream'] == id_stream).astype('int') which = (which / (len(stream_set['id_streams']) + 1)).astype('bool') delta = records[which]['delta'] distance = records[which][id_distance] step = float(i) / max(len(id_ddss) - 1, 1) xstep = W * 2 * (step - 0.5) fancy_error_display(ax, delta + xstep, distance, colors[i], perc=perc, label='%s' % i) with f.plot('distance', caption='treams: %s, Distance: %s' % (stream_set['label'], id_distance), **dp_predstats_fig) as pylab: ax = pylab.subplot(111) for i, id_dds in enumerate(id_ddss): which = (records['id_discdds'] == id_dds).astype('int') for id_stream in stream_set['id_streams']: which += (records['id_stream'] == id_stream).astype('int') which = (which / (len(stream_set['id_streams']) + 1)).astype('bool') delta = records[which]['delta'] distance = records[which][id_distance] step = float(i) / max(len(id_ddss) - 1, 1) xstep = W * 2 * (step - 0.5) fancy_error_display(ax, delta + xstep, distance, colors[i], perc=perc, label='%s' % i) legend_put_below(ax) with f.plot('difference', caption='Difference from learner_0, SStreams: %s, Distance: %s' % (stream_set['label'], id_distance), **dp_predstats_fig) as pylab: ax = pylab.subplot(111) which0 = (records['id_discdds'] == id_ddss[0]) _ = records[which0]['delta'] # delta0 distance0 = records[which0][id_distance] for i, id_dds in enumerate(id_ddss[1:]): which = (records['id_discdds'] == id_dds).astype('int') for id_stream in stream_set['id_streams']: which += (records['id_stream'] == id_stream).astype('int') which = (which / (len(stream_set['id_streams']) + 1)).astype('bool') delta = records[which]['delta'] distance = records[which][id_distance] difference = distance0 - distance step = float(i) / max(len(id_ddss) - 1, 1) xstep = W * 2 * (step - 0.5) fancy_error_display(ax, delta + xstep, difference, colors[i + 1], perc=perc, label='%s' % i) return r
def report_stats(records, id_ddss, id_streams, id_distances): r = Report('precision-stats') r.data('records', records) colors = list(islice(cycle(['r', 'g', 'b', 'k', 'y', 'm']), 50)) perc = 10 W = 0.2 for i, id_dds in enumerate(id_ddss): r.text('dds%s' % i, id_dds) streams_sets = generate_stream_sets(id_streams) for stream_set, id_distance in itertools.product(streams_sets, id_distances): f = r.figure(cols=2) with f.plot('distance_legend', caption='Streams: %s, Distance: %s' % (stream_set['label'], id_distance), **dp_predstats_fig) as pylab: ax = pylab.subplot(111) for i, id_dds in enumerate(id_ddss): which = (records['id_discdds'] == id_dds).astype('int') for id_stream in stream_set['id_streams']: which += (records['id_stream'] == id_stream).astype('int') which = (which / (len(stream_set['id_streams']) + 1)).astype('bool') delta = records[which]['delta'] distance = records[which][id_distance] step = float(i) / max(len(id_ddss) - 1, 1) xstep = W * 2 * (step - 0.5) fancy_error_display(ax, delta + xstep, distance, colors[i], perc=perc, label='%s' % i) with f.plot('distance', caption='treams: %s, Distance: %s' % (stream_set['label'], id_distance), **dp_predstats_fig) as pylab: ax = pylab.subplot(111) for i, id_dds in enumerate(id_ddss): which = (records['id_discdds'] == id_dds).astype('int') for id_stream in stream_set['id_streams']: which += (records['id_stream'] == id_stream).astype('int') which = (which / (len(stream_set['id_streams']) + 1)).astype('bool') delta = records[which]['delta'] distance = records[which][id_distance] step = float(i) / max(len(id_ddss) - 1, 1) xstep = W * 2 * (step - 0.5) fancy_error_display(ax, delta + xstep, distance, colors[i], perc=perc, label='%s' % i) legend_put_below(ax) with f.plot( 'difference', caption='Difference from learner_0, SStreams: %s, Distance: %s' % (stream_set['label'], id_distance), **dp_predstats_fig) as pylab: ax = pylab.subplot(111) which0 = (records['id_discdds'] == id_ddss[0]) _ = records[which0]['delta'] # delta0 distance0 = records[which0][id_distance] for i, id_dds in enumerate(id_ddss[1:]): which = (records['id_discdds'] == id_dds).astype('int') for id_stream in stream_set['id_streams']: which += (records['id_stream'] == id_stream).astype('int') which = (which / (len(stream_set['id_streams']) + 1)).astype('bool') delta = records[which]['delta'] distance = records[which][id_distance] difference = distance0 - distance step = float(i) / max(len(id_ddss) - 1, 1) xstep = W * 2 * (step - 0.5) fancy_error_display(ax, delta + xstep, difference, colors[i + 1], perc=perc, label='%s' % i) return r