Ejemplo n.º 1
0
    fig, ax = plt.subplots(1, 1)
    for i, target in enumerate(targets):
        print('doing channel %s' % target)
        inChannels_single = np.array(['I1V', 'I2V', 'I3V', 'MWI-15', 'MWI-16'])
        file_single = 'qrnn_ici_%s_%s_%s_mwi-alone.nc' % (depth, width, target)

        print(file_single)
        i183, = np.argwhere(inChannels_single == target)[0]
        print(i183)
        y_pre, y_prior, y0, y, y_pos_mean =\
            read_qrnn(file_single, inChannels_single, target)
        im = np.abs(y_pre[:, 3] - y_prior[:, i183]) <= 7.5
        #   im = np.abs(y_prior[:, i183]- y0) <= 7.5
        print('rejected QRNN ', (1 - np.sum(im) / im.size) * 100)

        bia = stats.calculate_bias(y_prior, y0, y, y_pre[:, 3], im, i183)
        std = stats.calculate_std(y_prior, y0, y, y_pre[:, 3], im, i183)
        ske = stats.calculate_skew(y_prior, y0, y, y_pre[:, 3], im, i183)
        mae = stats.calculate_mae(y_prior, y0, y, y_pre[:, 3], im, i183)

        print('rejected B183 ', (np.sum(im_b) / im_b.size) * 100)
        bia_b = stats.calculate_bias(y_prior, y0, y, y_pre[:, 3], ~im_b, i183)
        std_b = stats.calculate_std(y_prior, y0, y, y_pre[:, 3], ~im_b, i183)
        ske_b = stats.calculate_skew(y_prior, y0, y, y_pre[:, 3], ~im_b, i183)
        mae_b = stats.calculate_mae(y_prior, y0, y, y_pre[:, 3], ~im_b, i183)

        #%%
        bia = list(bia + bia_b)
        mae = list(mae + mae_b)
        ske = list(ske + ske_b)
        std = list(std + std_b)
Ejemplo n.º 2
0
    #%%

    for i, target in enumerate(targets):
        inChannels_single = np.array([target, 'I5V' , 'I6V', 'I7V', 'I8V', \
                                      'I9V', 'I10V', 'I11V'])
        file_single = 'qrnn_ici_%s_%s_%s_single.nc' % (depth, width, target)
        print(file_single)
        i183, = np.argwhere(inChannels_single == target)[0]

        y_pre, y_prior, y0, y, y_pos_mean = read_qrnn(file_single,\
                                                      inChannels_single, target )
        im = np.abs(y_pre[:, 3] - y_prior[:, i183]) >= 10
        print((np.sum(im) / im.size) * 100)

        bia = stats.calculate_bias(y_prior, y0, y, y_pre[:, 3], im, i183)
        std = stats.calculate_std(y_prior, y0, y, y_pre[:, 3], im, i183)
        ske = stats.calculate_skew(y_prior, y0, y, y_pre[:, 3], im, i183)
        mae = stats.calculate_mae(y_prior, y0, y, y_pre[:, 3], im, i183)



        inChannels_all = np.array(['I1V', 'I2V', 'I3V', 'I5V' , 'I6V', 'I7V', \
                                   'I8V', 'I9V', 'I10V', 'I11V'])
        file_all = 'qrnn_ici_%s_%s_%s.nc' % (depth, width, target)
        print(file_all)
        i183, = np.argwhere(inChannels_all == target)[0]
        y_pre, y_prior1, y01, y, y_pos_mean1 = read_qrnn(file_all,\
                                                         inChannels_all, target )
        im = np.abs(y_pre[:, 3] - y_prior[:, i183]) >= 10
        print((np.sum(im) / im.size) * 100)
Ejemplo n.º 3
0
ax2 = ax.twinx()
for i, target in enumerate(targets):
    inChannels_single = np.array(
        [target, 'I5V', 'I6V', 'I7V', 'I8V', 'I9V', 'I10V', 'I11V'])
    file_single = 'qrnn_ici_%s_%s_%s_single.nc' % (depth, width, target)
    print(file_single)
    i183, = np.argwhere(inChannels_single == target)[0]

    y_pre, y_prior, y0, y, y_pos_mean = read_qrnn(file_single,
                                                  inChannels_single, target)

    bias = ()
    rej = []
    for j in filters:
        im = np.abs(y_pre[:, 3] - y_prior[:, i183]) <= j
        bias += stats.calculate_bias(y_prior, y0, y, y_pre[:, 3], im, i183)
        rej.append((1 - np.sum(im) / im.size) * 100)

    bias = np.array(list(bias))
    #    rej = list(rej)
    color = 'tab:red'
    ax.plot( bias[[4, 9, 14, 19, 24, 29, 34, 39, 44, 49]], color = color,\
            linewidth = 2.5, linestyle = linetype[i])
    ax.set_ylim(-0.35, 0)

    # instantiate a second axes that shares the same x-axis

    color = 'tab:blue'
    ax2.plot(rej, linestyle = linetype[i], color = color, \
             linewidth = 2.5)