Ejemplo n.º 1
0
def plot_distr(ax):

    core.show_axis(ax)
    core.make_spines(ax)

    # Load data
    theo_distr = core.get_data('fig2/sampling_illustr_theo.npy')
    sim_distr = core.get_data('fig2/sampling_illustr_sim.npy')

    x = np.array(list(range(0, len(sim_distr))))
    # make the bar plots
    ylabels = ['0.05', '0.1', '0.2']
    ax.bar(x,
           theo_distr,
           width=0.35,
           label='target',
           bottom=1E-3,
           color='tab:blue')
    ax.bar(x + 0.35,
           sim_distr,
           width=0.35,
           label='sampled',
           bottom=1E-3,
           color='tab:orange')
    ylim = ax.get_ylim()
    ylimNew = [0., ylim[1]]
    ax.set_ylim(ylimNew)
    ax.set_xlim([min(x - .35), max(x + 0.35 + .35)])
    ax.legend(fontsize=13)

    ax.set_xlabel(r'$\mathbf{z}$, states', fontsize=16)
    ax.set_ylabel(r'$p_\mathrm{joint}(\mathbf{z})$', fontsize=16)
    ax.set_xticks(x + 0.35 / 2.0)
    ax.set_xticklabels(
        ['000', '001', '010', '011', '100', '101', '110', '111'], fontsize=10)
Ejemplo n.º 2
0
def plot_mnistIterError(ax):

    # Set up the plot
    core.show_axis(ax)
    core.make_spines(ax)

    # Load the data
    abstractRatio = core.get_data('fig5/mnistAbstract.npy')
    classRatio = core.get_data('fig5/mnistClassRatios.npy')
    iterNumb = core.get_data('fig5/mnistClassRatiosArray.npy')

    # Do the plot
    aux.plotITLTrainingError(ax, abstractRatio, classRatio, iterNumb)
    ax.set_ylim([-.04, .25])
    ax.legend(loc='lower left', bbox_to_anchor=(0.05, 0.01),
               fontsize=9)

    # Add inset with mixture matrix
    #iax = plt.axes([0, 0, 1, 1])
    #ip = InsetPosition(ax, [0.45, 0.25, 0.3, 0.7]) #posx, posy, width, height
    #iax.set_axes_locator(ip)
    iax = inset_axes(ax, width = "50%", height= "50%", loc=1)

    # Load the data
    mixtureMatrix = core.get_data('fig5/mnistConfMatrix.npy')
    labels = [0, 1, 4, 7]

    # Do the plot
    iax.set_frame_on(True)
    aux.plotMixtureMatrix(iax, mixtureMatrix, labels)

    return
Ejemplo n.º 3
0
def plot_dklSon(ax):

    core.show_axis(ax)
    core.make_spines(ax)

    # load the data
    DKLtimeValue = core.get_data('fig4/fig4_DKLtimeValueSon.npy')
    DKLtimeArray = core.get_data('fig4/fig4_DKLtimeArraySon.npy')

    aux.suppPlotDklTime(ax, DKLtimeArray, DKLtimeValue)
    ax.set_ylim([7e-3, 5e0])
Ejemplo n.º 4
0
def plot_dklSon(ax):

    core.show_axis(ax)
    core.make_spines(ax)

    # load the data
    DKLtimeValue = core.get_data('fig5/fig5_dklTimeValueSon.npy')
    DKLtimeArray = core.get_data('fig5/fig5_dklTimeArraySon.npy')

    aux.suppPlotDklTime(ax, DKLtimeArray, DKLtimeValue)
    ax.text(8e1, 8., 'Decorrelation Network', weight='bold')
    ax.set_ylim([6e-3, 6e0])
Ejemplo n.º 5
0
def plot_jointPoisson(ax):

    core.show_axis(ax)
    core.make_spines(ax)

    # load the data
    sampled = core.get_data('fig5/fig5_jointPoisson.npy')
    target = core.get_data('fig5/fig5_jointTarget.npy')

    aux.suppPlotDistributions(ax, sampled, target, errorBar=False)
    ax.legend(loc='lower left', bbox_to_anchor=(0.02, 0.4))
    ax.set_xlabel(r'$\mathbf{z}$, states')
    ax.set_ylim([0., 0.79])
Ejemplo n.º 6
0
def plot_dklPoisson(ax):

    core.show_axis(ax)
    core.make_spines(ax)

    # load the data
    DKLtimeValue = core.get_data('fig5/fig5_dklTimeValuePoisson.npy')
    DKLtimeArray = core.get_data('fig5/fig5_dklTimeArrayPoisson.npy')

    aux.suppPlotDklTime(ax, DKLtimeArray, DKLtimeValue)

    ax.text(1e2, 8., 'Poisson noise', weight='bold')
    ax.set_ylim([6e-3, 6e0])
Ejemplo n.º 7
0
def plot_marginalSon(ax):

    core.show_axis(ax)
    core.make_spines(ax)

    # load the data
    sampled = core.get_data('fig5/fig5_margSon.npy')
    target = core.get_data('fig5/fig5_margTarget.npy')

    aux.suppPlotDistributions(ax, sampled, target)

    ax.set_xlabel(r'neuron id')
    ax.legend(loc='lower left', bbox_to_anchor=(0.2, 0.8), ncol=2, fontsize=8)
    ax.set_ylim([0., 1.2])
Ejemplo n.º 8
0
def plot_actFunc(ax):

    core.show_axis(ax)
    core.make_spines(ax)

    # Do the activation function
    # Dummy data to work with something
    wBias  = np.arange(-15, 16)
    dataP = core.get_data('fig3/actFunc.npy')
    dataSon = core.get_data('fig3/actFuncSon.npy')
    ax.plot(wBias, np.mean(dataP, axis=1),
                linewidth=0.6, marker='x',
                label='Poisson',
                color='tab:blue')
    ax.plot(wBias, np.mean(dataSon,axis=1),
                linewidth=0.6, marker='x',
                label='RN',
                color='tab:orange')
    ax.set_xlabel(r'$w_\mathrm{b} \; [HW. u.]$',fontsize=12)
    ax.set_ylabel(r'mean frequency $\langle \nu \rangle \; [Hz]$',fontsize=12)
    ax.set_xlim([-15.5, 15.5])
    ax.legend(loc=4)

    # make the inset
    # make dummy data
    data = core.get_data('fig3/biasTraces.npy')
    index = np.where(data[:,0] == 0)[0]
    time = data[index,1]
    voltage = data[index,2]
    iax = inset_axes(ax,
                     width = "80%",
                     height= "80%",
                     loc=10,
                     bbox_transform=ax.transAxes,
                     bbox_to_anchor=(.15,.3, .34, .6))
    core.show_axis(iax)
    core.make_spines(iax)
    iax.plot(time, voltage, linewidth=1, color='xkcd:brick red')
    iax.set_ylabel(r'$u_\mathrm{b} \; [mV]$', fontsize=12)
    iax.set_xlabel(r'$t \; [ms]$', fontsize=12)
    iax.set_ylim([-55, -37])
    iax.set_xlim([2000., 2035.])
    iax.set_title('bias neuron')
    iax.tick_params(axis='both', which='both')

    


    return
Ejemplo n.º 9
0
def plot_marginalPoisson(ax):

    # This is a tikz picture and it will be created in the tex document

    core.show_axis(ax)
    core.make_spines(ax)

    # load the data
    sampled = core.get_data('fig5/fig5_margPoisson.npy')
    target = core.get_data('fig5/fig5_margTarget.npy')

    aux.suppPlotDistributions(ax, sampled, target)
    ax.set_xlabel(r'neuron id')
    ax.legend(loc='lower left', bbox_to_anchor=(0.2, 0.8), ncol=2, fontsize=8)
    ax.set_ylim([0., 1.2])
Ejemplo n.º 10
0
def plot_trainingSon(ax):

    core.show_axis(ax)
    core.make_spines(ax)

    # load the data
    DKLiter = core.get_data('fig4/fig4_DKLiterArraySon.npy')
    DKLiterValue = core.get_data('fig4/fig4_DKLiterValueSon.npy')
    DKLfinal = core.get_data('fig4/fig4_DKLtimeValueSon.npy')

    aux.suppPlotTraining(ax, DKLiterValue, DKLfinal, DKLiter)

    ax.text(70, 4., 'Decorrelation Network', weight='bold')
    ax.legend(loc='lower left', bbox_to_anchor=(0.5, 0.7))
    ax.set_ylim([8e-3, 2.2e0])
Ejemplo n.º 11
0
def plot_fashionTsne(ax):

    # get the data
    nImages = 150
    images = core.get_data('fig6/fashionImages.npy')
    positions = core.get_data('fig6/fashionPositions.npy')
    picSize = (12, 12)

    # trim the data
    indices = np.linspace(0, len(positions[:,0]),
                          endpoint=False, num=nImages).astype(int)
    images = images[indices[1:]]
    positions = positions[indices[1:]]

    # do the plotting
    aux.plot_tsne(ax, images, positions, picSize)
Ejemplo n.º 12
0
def plot_otherDistr5(ax):

    core.show_axis(ax)
    core.make_spines(ax)
    distributions = core.get_data("fig4/fig4_otherDistr.npy")

    numDistrs = len(distributions[:, 0])
    x = np.array(list(range(0, len(distributions[0, :]))))
    width = 0.5

    ax.bar(x,
           distributions[4, :],
           width=width,
           label='ID {}'.format(5),
           bottom=1E-3,
           color=colors[4])

    ax.set_title('ID 5')
    ax.set_xlabel(r'$\mathbf{z}$, states', fontsize=12)
    #ax.set_ylabel(r'$p_\mathrm{joint}(\mathbf{z})$', fontsize=12)
    ax.set_xlim([min(x - .75), max(x + .35)])
    ax.set_xticks([])
    ax.set_yticks([0.1])

    return
Ejemplo n.º 13
0
def plot_mnist(ax):

    # load the data
    original = core.get_data('fig2/mnist_orig.npy')

    # Do the actual plotting
    aux.plotExamplePictures(ax, original, (12, 12), (28, 28), (2, 4))
Ejemplo n.º 14
0
def plot_compLabel(ax):

    core.show_axis(ax)
    labels = [0,1,4,7]
    N_labels = len(labels)
    dt = 2
    tMin = 100.
    tMax = 350.
    tMinIndex = int(tMin/dt)
    tMaxIndex = int(tMax/dt)

    labelImage = core.get_data('fig5/686labelPatchMnistDyn.npy')[tMinIndex:tMaxIndex,:]
    ax.imshow(np.flipud(labelImage.T),
             cmap=cm.gray_r,
             vmin=0., vmax=1.,
             aspect='auto',
             interpolation='nearest',
             extent=(-50., 200., -.5,N_labels - .5))
             #extent=(-.5, N_labels - .5,200.,-50.))
    ax.set_yticks(list(range(N_labels)))
    ax.set_yticklabels(labels)
    for tick in ax.xaxis.get_major_ticks():
                tick.label.set_fontsize(11)
    ax.tick_params(width=0, length=0)
    ax.set_xlabel(r'$t$ [ms]', fontsize=12)
    ax.set_ylabel('label', labelpad=0, fontsize=12)
    ax.axvline(x=0, ymin=-.02, ymax=1.58, color='tab:green', linestyle='--',
               clip_on=False, linewidth=2)
Ejemplo n.º 15
0
def plot_label(ax):

    core.show_axis(ax)
    labels = [0, 1, 4, 7]
    N_labels = len(labels)
    dt = 2
    tMin = 100.
    tMax = 350.
    tMinIndex = int(tMin / dt)
    tMaxIndex = int(tMax / dt)

    labelImage = core.get_data('figPattern/686labelPatchMnistDyn.npy')[
        tMinIndex:tMaxIndex, :]
    ax.imshow(labelImage,
              cmap=cm.gray_r,
              vmin=0.,
              vmax=1.,
              aspect='auto',
              interpolation='nearest',
              extent=(-.5, N_labels - .5, 200., -50.))
    ax.set_xticks(list(range(N_labels)))
    ax.set_xticklabels(labels)
    for tick in ax.yaxis.get_major_ticks():
        tick.label.set_fontsize(8)
    ax.tick_params(width=0, length=0)
    ax.set_ylabel(r'$t$ [ms]')
    ax.set_xlabel('label response', labelpad=0)
Ejemplo n.º 16
0
def plot_mnistTraining(ax):

    # Set up the plot
    core.show_axis(ax)
    core.make_spines(ax)

    # Load the data
    abstractRatio = core.get_data('figInference/mnistAbstract.npy')
    classRatio = core.get_data('figInference/mnistClassRatios.npy')
    iterNumb = core.get_data('figInference/mnistClassRatiosArray.npy')

    # Do the plot
    aux.plotITLTraining(ax, abstractRatio, classRatio, iterNumb)
    ax.legend()

    return
Ejemplo n.º 17
0
def plot_mseTime(ax):

    # Set up the plot
    core.show_axis(ax)
    core.make_spines(ax)

    # load the data
    timeArray = core.get_data('figPattern/fashionTimeArray.npy')
    mseFashionSandp = core.get_data('figPattern/fashionMseSandp.npy')
    mseFashionPatch = core.get_data('figPattern/fashionMsePatch.npy')
    mseMnistSandp = core.get_data('figPattern/mnistMseSandp.npy')
    mseMnistPatch = core.get_data('figPattern/mnistMsePatch.npy')

    # set up the data
    datas = [mseFashionPatch, mseFashionSandp, mseMnistPatch, mseMnistSandp]
    labels = ['fashion Patch', 'fashion S&P', 'MNIST Patch', 'MNIST S&P']
    colors = ['xkcd:crimson', 'xkcd:forest green', 'xkcd:coral', 'xkcd:lime']
    timeArray = timeArray - 150.

    # do the plotting
    for index in range(4):
        data = datas[index]

        median = np.median(data, axis=0)
        value75 = np.percentile(data, 75, axis=0)
        value25 = np.percentile(data, 25, axis=0)
        ax.plot(timeArray,
                median,
                linewidth=1.5,
                color=colors[index],
                label=labels[index])
        ax.fill_between(
            timeArray,
            value25,
            value75,
            color=colors[index],
            alpha=0.2,
            linewidth=0.0,
        )

    # annotate the plot
    ax.set_xlabel(r'$t$ [ms]', labelpad=5)
    ax.set_ylabel('mean squared\nerror [1]')
    ax.set_xlim([-100., 220.])
    ax.legend(fontsize=8)

    pass
Ejemplo n.º 18
0
def plot_classRatio(ax):

    # Set up the plot
    core.show_axis(ax)
    core.make_spines(ax)

    # load the data
    mnistAbstract = core.get_data('figPattern/mnistAbstract.npy')
    mnistHWRef = core.get_data('figPattern/mnistHWRef.npy')
    mnistSandp = core.get_data('figPattern/mnistSandp.npy')
    mnistPatch = core.get_data('figPattern/mnistPatch.npy')
    fashionAbstract = core.get_data('figPattern/fashionAbstract.npy')
    fashionHWRef = core.get_data('figPattern/fashionHWRef.npy')
    fashionSandp = core.get_data('figPattern/fashionSandp.npy')
    fashionPatch = core.get_data('figPattern/fashionPatch.npy')

    # Set up the arrays to plot the bar diagram
    gapSize = 0.4
    x = [np.array([0., 2.]) + gapSize * x for x in range(4)]
    y = [
        np.array([np.mean(mnistAbstract),
                  np.mean(fashionAbstract)]),
        np.array([mnistHWRef, fashionHWRef]),
        np.array([mnistSandp, fashionSandp]),
        np.array([mnistPatch, fashionPatch])
    ]
    colors = ['blue', 'red', 'green', 'xkcd:mustard']
    labels = ['software', 'hardware', 'S&P', 'Patch']

    for index in range(4):
        ax.bar(x[index],
               y[index],
               width=0.35,
               label=labels[index],
               color=colors[index])

    # Set up the labels
    ax.set_ylabel('classification ratio [1]')
    ax.xaxis.set_major_locator(MaxNLocator(integer=True))
    ax.yaxis.set_major_locator(MaxNLocator(integer=True))
    ax.tick_params(length=0., pad=5)
    #ax.set_xticks([0.5*(x[1][0] + x[2][0]), 0.5*(x[1][1] + x[2][1])])
    ax.set_xticks([x[1][0] + 0.5 * gapSize, x[1][1] + 0.5 * gapSize])
    ax.set_xticklabels(['MNIST', 'fashion\nMNIST'], fontsize=10)
    ax.tick_params(axis='both', which='minor')
    ax.set_xlim([-.4, 3.6])
    ax.axhline(y=1.,
               xmin=-.4,
               xmax=3.6,
               linewidth=.2,
               linestyle='--',
               color='k')
    ax.set_ylim([0., 1.2])
    center = 0.5 * (x[3][0] + 0.35 + x[0][1])
    ax.legend(loc='upper center', fontsize=8, ncol=2, bbox_to_anchor=(.5, 1.2))

    pass
Ejemplo n.º 19
0
def plot_tracesToStates(ax):

    volts = core.get_data('fig2/fig2_trace.npy')
    fontSize = 14

    for i, v in enumerate(volts):
        ax.plot(v + i * 3. - 3., '-k')
        if i == 2:
            t1Max = np.max(v + i * 3. - 3.)
            t1Reset = (v + i * 3. - 3.)[150]
        if i == 0:
            t3Max = np.max(v + i * 3. - 3.)
            t3Reset = (v + i * 3. - 3.)[150]
    ax.text(170, -57.5, r't [a.u.]', fontsize=fontSize)

    ax.text(-50, -48.5, r'$u_3$', fontsize=fontSize)
    ax.text(-50, -51.5, r'$u_2$', fontsize=fontSize)
    ax.text(-50, -54.5, r'$u_1$', fontsize=fontSize)

    ax.text(140., -44.7, '101', color='r', rotation=90, fontsize=fontSize)
    ax.text(290., -44.7, '100', color='r', rotation=90, fontsize=fontSize)
    ax.text(-50., -46.4, 'z', color='r', fontsize=fontSize)

    ax.axvline(150., ymin=.015, ymax=.78, color='r')
    ax.axvline(300., ymin=.015, ymax=.78, color='r')

    # Add path to trace one
    t1rect = patches.Rectangle((140, t1Reset),
                               100,
                               t1Max - t1Reset,
                               linewidth=0,
                               facecolor="tab:green",
                               alpha=0.3)
    ax.add_patch(t1rect)

    # Add path to trace three
    spikeTimes = [0, 62, 258.5, 376]
    widths = [46, 100, 100, 40]
    for (spikeTime, width) in zip(spikeTimes, widths):
        t3rect = patches.Rectangle((spikeTime, t3Reset),
                                   width,
                                   t3Max - t3Reset,
                                   linewidth=0,
                                   facecolor="tab:green",
                                   alpha=0.3)
        ax.add_patch(t3rect)

    rect = patches.Rectangle((140, -51),
                             50,
                             3,
                             linewidth=0,
                             edgecolor='r',
                             facecolor="red",
                             alpha=0.3)
    #ax.add_patch(rect)

    ax.set_ylim(-55.5, -44)

    return
Ejemplo n.º 20
0
def plot_boxAndWhiskers(ax):
    '''
        Plot box and whiskers plot of DKLs (joint) after training with Poisson
        over several sampled distributions
    '''

    core.show_axis(ax)
    core.make_spines(ax)

    # load the joint Poisson DKL from fig4
    DKLfinalPoisson = core.get_data('fig4/fig4_DKLtimeValuePoisson.npy')
    refDKLs = DKLfinalPoisson[:, -1]

    # load the data
    dataPoisson = core.get_data('figAppendix1/poissonJointsDKL.npy')

    # gather the data into an array
    data = [dataPoisson[i, :] for i in range(len(dataPoisson[:, 0]))]
    indexToShow = [0, 1, 6, 7, 19]
    dataFiltered = [data[i] for i in indexToShow]
    data = [refDKLs] + dataFiltered

    # plot
    b1 = ax.boxplot(
        data[0],
        sym='x',
        positions=[0],
        widths=0.5,
        #flierprops={'markeredgecolor': 'tab:blue'},
        boxprops={'facecolor': 'tab:blue'},
        patch_artist=True)
    #for element in ['caps']:
    #    p.setp(b1[element], color='tab:blue')
    ax.boxplot(data[1:], sym='x', widths=0.5, positions=list(range(1, 6)))
    ax.set_xlim([-0.6, 5.6])
    ax.set_yscale('log')
    #ax.text( 0.1, 1e-3, 'data for\nFig. 4B', ha='center')
    ax.set_ylabel(
        r'$\mathregular{D}_\mathregular{KL} \left[ \, p(\mathbf{z}) \, || \, p\!^*(\mathbf{z}) \, \right]$',
        fontsize=12)
    ax.set_xlabel(r'# Distribution ID', fontsize=12)
    ax.set_xticks([0, 1, 2, 3, 4, 5])
    ax.set_xticklabels(["C", "1", "2", "3", "4", "5"], fontsize=11)
    ax.set_ylim([7e-4, 2e0])

    return
Ejemplo n.º 21
0
def plot_dklTime(ax):

    dkls = core.get_data('fig1_ll_dkls.npy')
    dkl_times = core.get_data('fig1_ll_dkl_times.npy')

    core.show_axis(ax)
    core.make_spines(ax)

    for dkl in dkls:
        ax.plot(dkl_times, dkl)

    ax.set_xscale('log')
    ax.set_yscale('log')

    ax.set_xlabel(r'$t$ [ms]')
    ax.set_ylabel(
        r'$\mathregular{D}_\mathregular{KL} \left[ \, p(\mathbf{z}) \, || \, p\!^*(\mathbf{z}) \, \right]$')

    pass
Ejemplo n.º 22
0
def plot_infSingleDKL(ax):

    core.show_axis(ax)
    core.make_spines(ax)

    # load the data
    DKLtimeValuePoisson = core.get_data('fig4/fig5_dklTimeValuePoisson.npy')
    DKLtimeArrayPoisson = core.get_data('fig4/fig5_dklTimeArrayPoisson.npy')
    DKLtimeValueSon = core.get_data('fig4/fig5_dklTimeValueSon.npy')
    DKLtimeArraySon = core.get_data('fig4/fig5_dklTimeArraySon.npy')

    aux.suppPlotDklTime(ax, DKLtimeArrayPoisson, DKLtimeValuePoisson,
                        DKLtimeArraySon, DKLtimeValueSon)

    #ax.legend(loc='upper right')#, bbox_to_anchor=(0.3, 0.6))
    ax.set_ylim([8e-3, 5.e0])
    ax.set_xlim([0., 5e5])

    pass
Ejemplo n.º 23
0
def plot_mseFashion(ax):

    # Set up the plot
    core.show_axis(ax)
    core.make_spines(ax)

    # load the data
    timeArray = core.get_data('fig5/fashionTimeArray.npy')
    mseFashionSandp = core.get_data('fig5/fashionMseSandp.npy')
    mseFashionPatch = core.get_data('fig5/fashionMsePatch.npy')
    abstractFashionSandp = core.get_data('fig5/fashionAbstractMseSandpMseArray.npy')
    abstractFashionPatch = core.get_data('fig5/fashionAbstractMsePatchMseArray.npy')


    aux.plotMse(ax, timeArray, mseFashionPatch, mseFashionSandp,
                abstractFashionPatch, abstractFashionSandp)
    ax.set_ylim([0.0, 0.62])

    return
Ejemplo n.º 24
0
def plot_infProbDist(ax):

    core.show_axis(ax)
    core.make_spines(ax)

    # load the data
    sampledPoisson = core.get_data('fig4/fig5_jointPoisson.npy')
    target = core.get_data('fig4/fig5_jointTarget.npy')
    sampledSon = core.get_data('fig4/fig5_jointSon.npy')

    aux.suppPlotThreeDistributions(ax,
                                   sampledPoisson,
                                   sampledSon,
                                   target,
                                   errorBar=True)
    #ax.legend(bbox_to_anchor=(0.5, 0.8))
    #ax.set_ylim([0., .8])
    ax.set_xlabel(r'$\mathbf{z}$, states', fontsize=12)

    pass
Ejemplo n.º 25
0
def plot_dummy2(ax):

    data = core.get_data('dummy.npy')

    core.show_axis(ax)
    core.make_spines(ax)

    ax.plot(data)
    ax.set_xlabel('The x axis')
    ax.set_ylabel('The y axis')

    pass
Ejemplo n.º 26
0
def plot_pspPostCalib(ax):

    # Bunch of psps on several neurons overleaid
    # using the calibration
    time = core.get_data('fig1/pspTimePost.npy')
    v = core.get_data('fig1/pspVoltagePost.npy')

    aux.plotPSPs(ax, time, v)
    ax.set_title('post-calibration')

    # make inset
    iax = inset_axes(ax, width = "40%", height= "50%", loc="upper right")
    aux.plotPSPs(iax, time, v, normed=True)
    iax.set_xticks([])
    iax.set_yticks([])
    [yLow, yHigh] = iax.get_ylim()
    iax.set_ylim([yLow, yLow + 1.1 * (yHigh - yLow)])
    iax.set_xlabel(r't [ms]', fontsize=8)
    iax.set_ylabel(r'$u_\mathrm{normed}$ [1]', fontsize=8)

    pass
Ejemplo n.º 27
0
def plot_marginal(ax):

    core.show_axis(ax)
    core.make_spines(ax)

    # load the data
    sampledPoisson = core.get_data('fig4/fig4_finalMarginalPoisson.npy')
    target = core.get_data('fig4/fig4_targetMarginal.npy')
    sampledSon = core.get_data('fig4/fig4_finalMarginalSon.npy')

    aux.suppPlotThreeDistributions(ax,
                                   sampledPoisson,
                                   sampledSon,
                                   target,
                                   errorBar=True)
    #ax.legend(loc='upper right')
    ax.set_ylabel(r'$p_\mathrm{marginal}(z_i = 1)$', fontsize=12)
    #ax.set_ylim([0., 1.1])
    ax.set_xlabel('neuron id', fontsize=12)

    pass
Ejemplo n.º 28
0
def plot_infMarginal(ax):

    core.show_axis(ax)
    core.make_spines(ax)

    # load the data
    sampledPoisson = core.get_data('fig4/fig5_margPoisson.npy')
    target = core.get_data('fig4/fig5_margTarget.npy')
    sampledSon = core.get_data('fig4/fig5_margSon.npy')

    aux.suppPlotThreeDistributions(ax,
                                   sampledPoisson,
                                   sampledSon,
                                   target,
                                   errorBar=True)
    #ax.legend(bbox_to_anchor=(0.75, 0.75))
    #ax.set_ylim([0., 1.05])
    ax.set_xlabel('neuron id', fontsize=12)
    ax.set_ylabel(r'$p_\mathrm{marginal}(z_i = 1)$', fontsize=12)

    pass
Ejemplo n.º 29
0
def plot_mnistMixtureMatrix(ax):

    # Set up the plot
    core.show_axis(ax)
    core.make_spines(ax)

    # Load the data
    mixtureMatrix = core.get_data('figInference/mnistConfMatrix.npy')
    labels = [0, 1, 4, 7]

    # Do the plot
    aux.plotMixtureMatrix(ax, mixtureMatrix, labels)

    return
Ejemplo n.º 30
0
def plot_inferenceDklsS(ax):

    # set up the axes
    core.show_axis(ax)
    core.make_spines(ax)

    # load the joint Poisson DKL from fig4
    DKLfinalPoisson = core.get_data('fig4/fig5_dklTimeValueSon.npy')
    refDKLs = DKLfinalPoisson[:, -1]

    # load the data
    dataPoisson = core.get_data('figAppendix1/randomInfDKL.npy')

    # gather the data into an array
    data = [dataPoisson[i,:] for i in range(len(dataPoisson[:,0]))]
    data = [refDKLs] + data

    # plot
    aux.plotBoxPlot(ax, data)
    #ax.text( 0.1, 5e-3, 'data for\nFig. 4E', ha='center')
    ax.set_xticks([])
    ax.set_title('RN, inference', fontweight='bold')
    ax.set_ylim([7e-4, 2e0])