rearr_start = 50 rearr_period = 100 kld_max = 0.8 kld_data_loc = dir + "gradual-cd-normal-kld.out" ax2 = plt.subplot(nrows, ncols, 2) kldplt.kldplot(ax2, kld_data_loc, kld_max, countmin, countmax, rearr_start, rearr_period, False) ax2.axvline(moving_start, color='r', linestyle=':', linewidth=1) # Save # plt.legend() plt.savefig(name + '.pdf') plt.savefig(name + '.png') # Animated PDF step = 10 fps = 4 xmin = -1 xmax = 8 ymin = 0 ymax = 1 utd_animation2 = pdfplt.animated_pdfplot_bar( data_loc, countmin, countmax, step, lambda x, i: expected(x, moving_start, i), xmin, xmax, ymin, ymax) utd_animation2.save(name + '-histo.gif', writer='imagemagick', fps=fps)
kld_max = 0.15 kld_data_loc = dir + "basic-normal-kld.out" ax = plt.subplot(1, len(data_locs) + 1, len(data_locs) + 1) kldplt.kldplot(ax, kld_data_loc, kld_max, countmin, countmax, rearr_start, rearr_period) # Save Plot plt.legend() plt.savefig(name + '.pdf') plt.savefig(name + '.png') plt.show() # PDF: Animated start = 10 end = 500 step = 10 fps = 4 utd_animation1 = pdfplt.animated_pdfplot_errorbar(data_loc, start, end, step, expected, xmin, xmax, ymin, ymax) utd_animation1.save(name + '-errorbar.gif', writer='imagemagick', fps=fps) utd_animation2 = pdfplt.animated_pdfplot_bar(data_loc, start, end, step, expected, xmin, xmax, ymin, ymax) utd_animation2.save(name + '-histo.gif', writer='imagemagick', fps=fps)
ax = plt.subplot(1, len(data_counts) + 1, len(data_counts) + 1) ax.set_title("(d) KL-divergence") kldplt.kldplot(ax, kld_pdf_data_loc, kld_max, countmin, countmax, rearr_start, rearr_period) # Save Plot # plt.legend() plt.savefig(name + '.pdf') plt.savefig(name + '.png') # Animated start = 10 end = 500 step = 10 fps = 4 # PDF: Animated pdf_animation = pdfplt.animated_pdfplot_bar(pdf_data_loc, start, end, step, pdf_expected, xmin, xmax, ymin, ymax) pdf_animation.save(name + '-pdf.gif', writer='imagemagick', fps=fps) # CDF: Animated cdf_animation = cdfplt.animated_cdfplot(cdf_data_loc, delta_data_loc, start, end, step, cdf_expected, xmin, xmax, 0, 1) cdf_animation.save(name + '-cdf.gif', writer='imagemagick', fps=fps)