Пример #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)
Пример #2
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)
Пример #3
0
def plot_dummy1(ax):
    volts = np.linspace(2., 20., 100.)

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

    ax.plot(volts)
Пример #4
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)
Пример #5
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
Пример #6
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
Пример #7
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
Пример #8
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])
Пример #9
0
def plot_coding(axis):
    """arrows for coding plot"""
    # make the axis
    core.show_axis(axis)
    axis.spines['top'].set_visible(False)
    axis.spines['left'].set_visible(False)
    axis.spines['bottom'].set_visible(False)
    axis.spines['right'].set_visible(False)
    axis.set_xlabel("time [a.u.]")
    axis.xaxis.set_label_coords(.5, -0.05)
    axis.set_ylabel("neuron id")
    axis.yaxis.set_ticks_position('none')
    axis.xaxis.set_ticks_position('none')
    axis.set_xticks([])
    axis.set_yticks([])

    axis.set_xlim(0, 1)
    axis.set_ylim(0, 1)

    # #################### draw arrow instead of y axis to have arrow there
    # get width and height of axes object to compute
    # matching arrowhead length and width
    # fig = plt.gcf()
    # dps = fig.dpi_scale_trans.inverted()

    # bbox = axis.get_window_extent()  # .transformed(dps)
    # width, height = bbox.width, bbox.height

    xmin, xmax = axis.get_xlim()
    ymin, ymax = axis.get_ylim()

    # manual arrowhead width and length
    head_width = 1. / 20. * (ymax - ymin)
    head_length = 1. / 20. * (xmax - xmin)
    line_width = 0.5  # axis line width
    ohg = 0.3  # arrow overhang

    # compute matching arrowhead length and width
    # yhw = head_width / (ymax - ymin) * (xmax - xmin) * height / width
    # yhl = head_length / (xmax - xmin) * (ymax - ymin) * width / height

    axis.arrow(xmin,
               ymin,
               xmax - xmin,
               0,
               fc='k',
               ec='k',
               lw=line_width,
               head_width=head_width,
               head_length=head_length,
               overhang=ohg,
               length_includes_head=True,
               clip_on=False)
    return 0
Пример #10
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
Пример #11
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])
Пример #12
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])
Пример #13
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])
Пример #14
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])
Пример #15
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
Пример #16
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
Пример #17
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])
Пример #18
0
def plot_name(axis, name):
    """plot only a name"""
    core.show_axis(axis)
    axis.spines['top'].set_visible(False)
    axis.spines['left'].set_visible(False)
    axis.spines['bottom'].set_visible(False)
    axis.spines['right'].set_visible(False)

    axis.yaxis.set_ticks_position('none')
    axis.xaxis.set_ticks_position('none')
    axis.set_xticks([])
    axis.set_yticks([])

    axis.set_xlabel(name, fontsize=13)
    axis.xaxis.set_label_coords(.30, 0.50)
Пример #19
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])
Пример #20
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
Пример #21
0
def plot_psp_shapes(axis):
    "Plotting psp shapes" ""
    # make the axis
    core.show_axis(axis)
    core.make_spines(axis)

    xvals = np.linspace(0., 100., 200)
    t_s = 10.
    t_i = 15.

    def theta(value):
        return value > 0

    def voltage(time, t_m):
        factor = 1.
        if t_m < t_s:
            factor = 6. / t_m

        if t_m != t_s:
            ret_val = factor * t_m * t_s / (t_m - t_s) * theta(time - t_i) * \
                (np.exp(-(time - t_i) / t_m) - np.exp(-(time - t_i) / t_s))
        else:
            ret_val = factor * theta(time - t_i) * np.exp(
                -(time - t_i) / t_m) * (time - t_i)

        ret_val[time < t_i] = 0.
        return ret_val

    taums = [100000000., 20, 10, 0.0001]
    taums_name = [r"\rightarrow \infty", "= 2", "= 1", r"\rightarrow 0"]
    colours = ['C7', 'C8', 'C9', 'C6']
    for t_m, t_m_name, col in zip(taums, taums_name, colours):
        # axis.set_xlabel(r'$\tau_\mathrm{m}$ [ms]')
        lab = "$" + r'\tau_\mathrm{{m}} / \tau_\mathrm{{s}} {}'.format(
            t_m_name) + "$"
        axis.plot(xvals, voltage(xvals, t_m), color=col, label=lab)

    axis.set_yticks([])
    axis.set_xticks([])

    axis.set_ylabel("PSPs [a. u.]")
    axis.yaxis.set_label_coords(-0.03, 0.5)

    axis.set_xlabel("time [a. u.]")
    axis.xaxis.set_label_coords(.5, -0.075)

    axis.legend()
Пример #22
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
Пример #23
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
Пример #24
0
def plot_fashionMixtureMatrix(ax):

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

    # Load the data
    mixtureMatrix = core.get_data('figInference/fashionConfMatrix.npy')
    labels = ['t-shirt', 'trouser', 'sneaker']

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

    ax.set_xticklabels(labels, fontsize=8, rotation=45)
    ax.set_yticklabels(labels, fontsize=8, rotation=45)

    return
Пример #25
0
def plot_resp(ax):

    # Set up the plot
    core.show_axis(ax)
    core.make_spines(ax)
    respImages = core.get_data('figPattern/686respPatchMnistDyn.npy')

    # set up the parameters
    dt = 2
    tMin = 100.
    tMax = 350.
    tMinIndex = int(tMin / dt)
    tMaxIndex = int(tMax / dt)
    N_vertical = 5
    N_horizontal = 8
    N_all = N_vertical * N_horizontal
    half = 0
    frame = 1
    picSize = (24, 24)
    picSizeOrig = (12, 12)
    indices = np.round(np.linspace(tMinIndex, tMaxIndex), N_all).astype(int)
    respImages = respImages[indices, :]

    # Plot the upper 8 examples (originals)
    pic = np.ones(
        ((N_vertical + 1) * frame + N_vertical * picSize[0] + half,
         (N_horizontal + 1) * frame + N_horizontal * picSize[1])) * 255.
    for counter in range(N_vertical * N_horizontal):
        j = counter % N_horizontal
        i = int(counter / N_horizontal)
        picVec = respImages[counter, :]
        picCounter = np.reshape(picVec, picSizeOrig)
        picCounter = imresize(picCounter, picSize, interp='nearest')

        pic[(i + 1) * frame + i * picSize[0]:(i + 1) * frame +
            (i + 1) * picSize[0], (j + 1) * frame +
            j * picSize[1]:(j + 1) * frame + (j + 1) * picSize[1]] = picCounter

    ax.imshow(pic, cmap='Greys', aspect='auto')
    ax.set_xticks([], [])
    ax.set_yticks([], [])
    ax.set_xlabel('network response', labelpad=5)

    pass
Пример #26
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
Пример #27
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
Пример #28
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
Пример #29
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
Пример #30
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