Exemplo n.º 1
0
	lw = 2
	wlen = 7
	wtype = "hanning"

	plt.figure(figsize=(12, 4))
	plt.plot(xdata, [54]*len(xdata), "-", label="Chance level", color="#555753", linewidth=lw)
	plt.rcParams['font.size'] = 10
	plt.rcParams['font.family'] = "Ubuntu"
	
	plt.suptitle("Results")	

	for col in [2, 5, 8, 11]:

		ydata = np.array(d[:,col], dtype=float)
		yerr = np.array(d[:,col+1], dtype=float)	
		_smooth = smooth(ydata, window_len=2*wlen+1, window=wtype)[wlen:-wlen]
		color = colors.pop()
		color2 = colors2.pop()	
		plt.errorbar(xdata, ydata*100, yerr=yerr*100, fmt=",", color=color2, capsize=0, elinewidth=0.5)
		plt.plot(xdata, _smooth*100, "-", label=labels.pop(), color=color, linewidth=lw)	
	
	plt.ylim(50, 104) 			
	plt.legend(fancybox=True, borderpad=1)
	plt.xlabel('Noise (sigma)') 
	plt.ylabel('Clustering accuracy (%)') 
	plt.grid(True, color=(0,0,0))
	plt.savefig("plot.svg")
	plt.show()

Exemplo n.º 2
0
import matplotlib.pyplot as plt
from matplotlib import cm
from plotting import smooth, heatcurve

wlen = 7

d = np.loadtxt("summary.csv", dtype=str, skiprows=1, delimiter=", ")

for col in [38, 41, 47]:

	xdata = np.array(d[:,0], dtype=float) 
	ydata = np.array(d[:,col], dtype=float)*100
	yerr = np.array(d[:,col+1], dtype=float)*100
	a = np.swapaxes([ydata, yerr], 0, 1)

	_smooth = smooth(ydata, window_len=2*wlen+1)[wlen:-wlen]

	bfl = slider(a, wlen=wlen, lower=0, upper=46)
		
	fig = heatcurve(xdata, ydata, cdata=_smooth, yerr=yerr, yheat=np.log10(bfl),
		heatrange=(-3,3), threshold=2, size=(12,4), heatlabel="Log10(Bf)",
		ticks=range(-3,4))
	plt.xlabel('Noise (sigma)', figure=fig) 
	plt.ylabel('Difference in clustering accuracy (%)', figure=fig) 
	if col == 47:
		plt.ylim(-5, 50, figure=fig) 	
	else:
		plt.ylim(-5, 25, figure=fig) 	
	
	plt.rcParams['font.size'] = 10
	plt.rcParams['font.family'] = "Ubuntu"	
Exemplo n.º 3
0
                                indy = k
                                label = "df:" + str(df)
                            if wrt == "lr":
                                indx = i
                                indy = k
                                label = "lr:" + str(lr)
                            if wrt == "ms":
                                indx = i
                                indy = j
                                label = "ms:" + str(ms)

                            try:
                                filename = file_names[file_names_short.index(namee)]
                                dataframe = pd.read_csv(os.path.join(path, filename))
                                values = dataframe["Value"].tolist()
                                smoothed_values = smooth(values, smoothing_factor)
                                times = np.array(dataframe["Wall time"])[:len(smoothed_values)]/6000.
                                times -= times[0]  # Make it relative
                                name = filename.replace("run-CartPole-v0_", "").split("_2019")[0]
                                name = name.replace("_", " ").replace("-", ":")
                                # Plot in corresponding axes
                                ax[indy][indx].plot(times, smoothed_values, label=label)
                                # ax[indx][indy].set_title(title)
                                
                            except Exception as e:
                                print(e)
                                # print("Mising:")
                                # print(filename)
        # plt.set_xlabel('Relative Time [hours]')
        # plt.set_ylabel('Score [Points]')