def plot_influence(conf, mse_values, prediction_times, complexities): """ Plot influence of model complexity on both accuracy and latency. """ pl.figure(figsize=(12, 6)) host = host_subplot(111, axes_class=Axes) pl.subplots_adjust(right=0.75) par1 = host.twinx() host.set_xlabel('Model Complexity (%s)' % conf['complexity_label']) y1_label = conf['prediction_performance_label'] y2_label = "Time (s)" host.set_ylabel(y1_label) par1.set_ylabel(y2_label) p1, = host.plot(complexities, mse_values, 'b-', label="prediction error") p2, = par1.plot(complexities, prediction_times, 'r-', label="latency") host.legend(loc='upper right') host.axis["left"].label.set_color(p1.get_color()) par1.axis["right"].label.set_color(p2.get_color()) pl.title('Influence of Model Complexity - %s' % conf['estimator'].__name__) pl.show()
def plot_influence(conf, mse_values, prediction_times, complexities): # Plot influence of model complexity on both accuracy and latency. plt.figure(figsize = (12, 6)) host = host_subplot(111, axes_class = Axes) plt.subplots_adjust(right=0.75) par1 = host.twinx() host.set_xlabel('Model Complexity (%s)' % conf['complexity_label']) y1_label = conf['prediction_performance_label'] y2_label = 'Time (s)' host.set_ylabel(y1_label) par1.set_ylabel(y2_label) p1, = host.plot(complexities, mse_values, 'b-', label='prediciton error') p2, = par1.plot(complexities, prediction_times, 'r-', label='latency') host.legend(loc = 'upper right') host.axis['left'].label.set_color(p1.get_color()) par1.axis['right'].label.set_color(p2.get_color()) plt.title('Influence of Model Complexity - %s' % conf['estimator'].__name__) plt.show()
def plot_influence(conf, mse_values, prediction_times, complexities): """ Plot influence of model complexity on both accuracy and latency. """ pl.figure(figsize=(12, 6)) host = host_subplot(111, axes_class=Axes) pl.subplots_adjust(right=0.75) par1 = host.twinx() host.set_xlabel("Model Complexity (%s)" % conf["complexity_label"]) y1_label = conf["prediction_performance_label"] y2_label = "Time (s)" host.set_ylabel(y1_label) par1.set_ylabel(y2_label) p1, = host.plot(complexities, mse_values, "b-", label="prediction error") p2, = par1.plot(complexities, prediction_times, "r-", label="latency") host.legend(loc="upper right") host.axis["left"].label.set_color(p1.get_color()) par1.axis["right"].label.set_color(p2.get_color()) pl.title("Influence of Model Complexity - %s" % conf["estimator"].__name__) pl.show()
# Do the work for i in range(0,numOfChunks,step): yield sequence[i:i+winSize] r=csv.reader(open(sys.argv[1])) data = [row for row in r] msec_array = [row[1] for row in data] diff_array = [float(row[2]) for row in data] dev_array = abs(diff(diff_array)) #calculate mean values mean_diff = array(diff_array, dtype=float).mean() mean_dev = array(dev_array, dtype=float).mean() host = host_subplot(111) #par = host.twiny() host.set_xlabel(u"idő (ms)") host.set_ylabel(u"elétérés (pixel érték)") #plot diff_array host.plot(msec_array, diff_array, color='r') #plot(msec_array[:len(diff_array)], [mean_diff*5 for i in range(len(diff_array))], color='r') #plot dev_array host.plot(msec_array[:-1], dev_array, color='b') host.plot(msec_array[:len(dev_array)], [mean_dev*5 for i in range(len(dev_array))], color='b') plt.grid(True)