Пример #1
0
    def plot():

        plot = ctn_benchmark.Plot([
            ctn_benchmark.Data('nengo'),
            ctn_benchmark.Data('ocl'),
            ctn_benchmark.Data('spinn'),
            ctn_benchmark.Data('sp_rmv')
        ])

        plot.measures(['period', 'period_sd', 'peak', 'peak_sd'],
                      show_outliers=False)

        import pylab
        pylab.show()
Пример #2
0
    def fit():
        data = ctn_benchmark.Data('data')
        n_neurons = 200
        for d in data.data[:]:
            if d['_n_neurons'] != n_neurons:
                data.data.remove(d)

        target_data = [0.97, 0.94, 0.91, 0.80]  # experimental data

        import scipy.stats

        def prob(x, noise=1.0):
            return scipy.stats.norm.cdf(np.array(x) / noise)

        def curve(x, noise):
            return np.mean([prob(d['values'], noise=noise) for d in data.data],
                           axis=0)

        import scipy.optimize
        p, err = scipy.optimize.curve_fit(curve, np.arange(3), target_data)

        import pylab
        pylab.plot([2, 4, 6, 8], target_data)
        pylab.plot([2, 4, 6, 8], curve(None, *p))
        pylab.show()

        print p, err
Пример #3
0
    def plot():
        data = ctn_benchmark.Data('data')

        plt = ctn_benchmark.Plot(data)
        plt.lines('_n_neurons', ['rmse'])

        import pylab
        pylab.show()
Пример #4
0
    def plot():
        data = ctn_benchmark.Data('data')

        plot = ctn_benchmark.Plot(data)

        plot.vary('_N_reference', ['score1', 'score2', 'score3', 'score4'])

        import pylab
        pylab.show()
Пример #5
0
    def gather():
        data = ctn_benchmark.Data('compare')
        d = []
        for i in range(1, 9):
            d.append(1.0 - data.get('score%d' % i))
        d = np.array(d).T

        for row in d:
            print ', '.join(['%1.3f' % x for x in row])
Пример #6
0
    def plot():
        data = ctn_benchmark.Data('compare')

        plot = ctn_benchmark.Plot(data)

        plot.measures([
            'score1', 'score2', 'score3', 'score4', 'score5', 'score6',
            'score7', 'score8'
        ],
                      outlier_cutoff=None,
                      ylim=(0, 1))

        import pylab
        pylab.show()
Пример #7
0
    def plot():
        data = ctn_benchmark.Data('data')

        import pylab
        pylab.figure(figsize=(10, 5))

        Ns = np.linspace(10, 200, 5)
        for i, N in enumerate(Ns):
            pylab.subplot(1, len(Ns), i + 1)
            pylab.title('N=%d' % N)

            sd = 20
            N_refs = data.get('_N_reference')
            weights = np.exp(-(N_refs - N)**2 / (2 * sd**2))
            weights /= np.sum(weights)

            measures = ['score1', 'score2', 'score3', 'score4']

            low = []
            high = []
            sample = []
            for m in measures:
                d = data.get(m)
                d = 1.0 - d

                ci = ctn_benchmark.stats.bootstrapci(d,
                                                     np.mean,
                                                     weights=weights)
                low.append(ci[0])
                high.append(ci[1])
                sample.append(np.average(d, weights=weights))

            x = np.arange(len(measures)) + 1
            pylab.fill_between(x, low, high, color='#aaaaaa')
            pylab.plot(x, sample)
            pylab.ylim(0, 1)
            pylab.xticks(x)
            pylab.xlim(0.5, len(measures) + 0.5)

        pylab.tight_layout()
        pylab.show()