## offline ## try: perf = np.load('results/performance.npy') except IOError: try: S = np.load('results/spikes.npz')['S'] except IOError: S = [ csr_matrix( cfn.runpop_js(net.W, step, 1, rate, 1000, 20, 2, ref, run)) for run in range(10) ] np.savez_compressed('results/spikes.npz', S=S) Tls = range(501) rew = np.array( [[net.R4Pi2(net.get_policy2(step, i, T), net.pstart_state) for i in S] for T in Tls]) perf = (rew - R0) / (Rmax - R0) perf[0] = 0 np.save('results/performance', perf) pl.figure() errorfill(range(len(perf)), np.mean(perf, axis=1), yerr=np.std(perf, axis=1) / np.sqrt(len(perf[0]))) pl.xticks([0, 200, 400], [0, 200, 400]) pl.yticks([0, .5, 1.0], [0, .5, 1.0]) pl.xlim([0, 400]) pl.ylim([0, 1]) pl.xlabel('Time [ms]') pl.ylabel('Performance') simpleaxis(pl.gca())
try: perf = np.load('results/performance.npy') except IOError: try: S = np.load('results/spikes.npz')['S'] except IOError: S = [ csr_matrix(cfn.runpop_js(W, step, 1, rate, 1000, 20, 2, ref, run)) for run in range(10) ] np.savez_compressed('results/spikes.npz', S=S) Tls = range(501) rew = np.array([[ net.R4Pi2(net.get_policy2(step, i, T), 0, gamma, epsilon=.0001, max_iter=10**3) for i in S ] for T in Tls]) perf = (rew - R0) / (Rmax - R0) perf[0] = 0 np.save('results/performance', perf) pl.figure() errorfill(range(len(perf)), np.mean(perf, axis=1), yerr=np.std(perf, axis=1) / np.sqrt(len(perf[0]))) pl.xticks([0, 200, 400], [0, 200, 400]) pl.yticks([0, .5, 1.0], [0, .5, 1.0]) pl.xlim([0, 400]) pl.ylim([0, 1]) pl.xlabel('Time [ms]')