mlp_stes += [x[3] for x in mlp_results if x[1] == f[0]] # lstm_means = [x[2] for x in lstm_results] # lstm_stes = [x[3] for x in lstm_results] series = [mlp_means] #, lstm_means] series_labels = ['MLP'] #, 'LSTM'] series_errs = [mlp_stes] #, lstm_stes] plot_labels = [f[1] for f in features] from ss_plotting.make_plots import plot_bar_graph fig, ax = plot_bar_graph(series, series_labels=series_labels, series_errs=series_errs, series_colors=['grey'], category_labels=[f[1] for f in features], category_rotation=45, xpadding=0.3, show_plot=False, simplify=False) ax.set_ylim([0.70, 0.85]) xlim = ax.get_xlim() ax.set_xlim([xlim[0], xlim[1] - 0.5]) from ss_plotting import plot_utils plot_utils.simplify_axis(ax) plt.savefig("Feature_comparison.eps", format='eps', dpi=1000) import IPython IPython.embed() # ALl, 3F + RoC, 3F/P + RoC, 3F/T + ROC, Z-force + RoC
#!/usr/category/env python import numpy as np from ss_plotting.make_plots import plot_bar_graph import matplotlib.pyplot as plt # Pretty version of this plot: http://matplotlib.org/examples/api/barchart_demo.html categories = [''] proposed_means = [3.31] proposed_errs = [2.67] alvar_means = [5.08] alvar_errs = [2.39] series = [proposed_means, alvar_means] series_labels = ['Proposed', 'Alvar'] series_colors = ['red', 'blue'] ylabel = 'Rotation Error (degrees)' title = 'Average Rotation Errors' plot_bar_graph(series, series_colors, series_labels=series_labels, series_errs=[proposed_errs, alvar_errs], category_labels=categories, plot_ylabel=ylabel, plot_title=title, barwidth=0.25, fontsize=13, legend_fontsize=13)
xvals = range(1, max_selected_arms+1) # Now compute the actual value actual_vals = compute_actuals(arms, args.num_trials, max_selected_arms = max_selected_arms) bin_size = 0.1 hist_data, bin_edges = numpy.histogram(arms, bins=numpy.arange(0.0, 1.05, bin_size)) savefile = None if args.save_plots: savefile = 'histogram_%s.png' % arm_dist make_plots.plot_bar_graph([hist_data], [colors[aidx]], group_color_emphasis = [True], group_labels = None, plot_ylabel = 'Counts', plot_xlabel = 'Success Probability', bin_labels = bin_edges + 0.5*bin_size, savefile = savefile, savefile_size = (.5*4.75, .5*.5*4.75)) # Add expected value data all_data.append((xvals, expected_vals)) all_labels.append('Expected - %s' % arm_dist) all_colors.append(colors[aidx]) # all_color_emphasis.append(False) all_color_emphasis.append(True) # Add actual value data # all_data.append((xvals, actual_vals)) # all_labels.append('Actual - %s' % arm_dist) # all_colors.append(colors[aidx])
#!/usr/category/env python import numpy as np from ss_plotting.make_plots import plot_bar_graph import matplotlib.pyplot as plt # Pretty version of this plot: http://matplotlib.org/examples/api/barchart_demo.html categories = ['2 lux', '43 lux', '90 lux', '243 lux'] RGB_means = [0.24, 0.13, 0.03, 0.02] RGBD_means = [0.03, 0.01, 0.0, 0.0] series = [RGB_means, RGBD_means] series_labels = ['RGB', 'RGBD'] series_colors = ['red', 'blue'] ylabel = 'Error Percentage' title = 'Rotation Error w.r.t. to Lighting' plot_bar_graph(series, series_colors, series_labels=series_labels, category_labels = categories, plot_ylabel = ylabel, plot_title = title, category_padding = 0.45, fontsize=13, legend_fontsize=13)
def analyze(datafiles, title=None, out_basename=None): data = {} for datafile in datafiles: with open(datafile, "r") as f: print "Loading results from file: %s" % datafile data[datafile] = yaml.load(f) print "Done" # Calculate checks per second groups = [] for datafile in datafiles: d = data[datafile] elapsed = float(d["elapsed_ms"]) / 1000.0 checks = int(d["checks"]) checks_per_second = float(checks) / elapsed groups.append([checks_per_second]) colors = ["purple", "green", "blue", "orange", "red", "pink"] color_emphasis = [True for c in colors] group_labels = [name.split("_")[0] for name in datafiles] # Generate the plot of checks per second outfile = None if out_basename is not None: outfile = "%s.%s.%s" % (out_basename, "cps", "png") plot_bar_graph( groups, group_labels, colors[: len(groups)], group_color_emphasis=color_emphasis[: len(groups)], bin_ticks=False, plot_ylabel="Checks per second", plot_title=title, fontsize=12, legend_fontsize=12, savefile=outfile, savefile_size=(7, 3), ) if outfile is not None: logger.info("Saved checks per second data to file %s" % outfile) # Now generate the plot of average second per check if out_basename is not None: outfile = "%s.%s.%s" % (out_basename, "mspc", "png") new_groups = [[1000.0 * 1.0 / group[0]] for group in groups] plot_bar_graph( new_groups, group_labels, colors[: len(groups)], group_color_emphasis=color_emphasis[: len(groups)], bin_ticks=False, plot_ylabel="Milliseconds per check", plot_title=title, fontsize=12, legend_fontsize=12, savefile=outfile, savefile_size=(7, 3), ) if outfile is not None: logger.info("Saved milliseconds per check data to file %s" % outfile)