示例#1
0
        "M_mil_hi" : M_lsm_hi,

        "R_mil_mu" : R_lsm_mu,
        "R_mil_lo" : R_lsm_lo,
        "R_mil_hi" : R_lsm_hi
    }
)

df.to_csv("../../data/an_mil_c{0:}.csv".format(MYCASE))

##################################################
# Report
##################################################
print("Execution time: {} sec".format(t1-t0))

Colors = linspecer(5)

### Effective margin
plt.figure()
## Data
# Basis Value
plt.plot(N_ALL,100*M_bv_lo,
         color = Colors[0,:], linewidth = 1.0, linestyle = ":")
plt.plot(N_ALL,100*M_bv_mu,
         color = Colors[0,:], linewidth = 2.0, label='AN + BV')
for i in range(len(N_ALL)):
    plt.plot([N_ALL[i]*0.95, N_ALL[i]*0.95],
             [100*M_bv_mu[i], 100*M_bv_lo[i]],
             color = Colors[0,:],
             linewidth = 0.5)
示例#2
0
# matplotlib import block
import matplotlib
# choose the backend to handle window geometry
matplotlib.use("Qt4Agg")
# Import pyplot
import matplotlib.pyplot as plt
# Plot settings
offset = [(0,500),(700,500),(1400,500)] # window locations


# Example details
import numpy as np
import pyutil.plotting as ut

# Example plots
C = ut.linspecer(len(offset))

for i in range(len(offset)):
    # Generate some fake data
    X = np.linspace(-1,1)
    Y = np.random.random(len(X))
    # Plot
    plt.figure()
    plt.plot(X,Y,color=C[i])
    plt.xlabel('X')
    plt.ylabel('Y')
    plt.title('Data Set {}'.format(i+1))
    # Set plot location on screen
    manager = plt.get_current_fig_manager()
    # Grab window dimensions
    x,y,dx,dy = manager.window.geometry().getRect()
示例#3
0
    df["R_pri{0:d}_mu".format(p)] = R_pri_mc_mu[:, lnd]
    df["R_pri{0:d}_lo".format(p)] = R_pri_mc_lo[:, lnd]
    df["R_pri{0:d}_hi".format(p)] = R_pri_mc_hi[:, lnd]

df.to_csv("../../data/mc_mip_c{0:}{1:}.csv".format(MYCASE, suffix))

##################################################
# Report
##################################################
print("Execution time: {} sec".format(t1 - t0))

### Label formatting
Labels = ['L={0:1.0e}'.format(l) for l in L_ALL]
nplt = len(pIdx)
Colors = linspecer(len(L_ALL) * nplt)

### Effective margin --------------------------------------------------
plt.figure()
## Data
for lnd in range(len(L_ALL)):
    # MC mip
    if 0 in pIdx:
        plt.plot(N_ALL,
                 100 * M_mip_mc_lo[:, lnd],
                 color=Colors[0 + nplt * lnd, :],
                 linewidth=1.0,
                 linestyle=":")
        plt.plot(N_ALL,
                 100 * M_mip_mc_mu[:, lnd],
                 color=Colors[0 + nplt * lnd, :],
示例#4
0
"""
# matplotlib import block
import matplotlib
# choose the backend to handle window geometry
matplotlib.use("Qt4Agg")
# Import pyplot
import matplotlib.pyplot as plt
# Plot settings
offset = [(0, 500), (700, 500), (1400, 500)]  # window locations

# Example details
import numpy as np
import pyutil.plotting as ut

# Example plots
C = ut.linspecer(len(offset))

for i in range(len(offset)):
    # Generate some fake data
    X = np.linspace(-1, 1)
    Y = np.random.random(len(X))
    # Plot
    plt.figure()
    plt.plot(X, Y, color=C[i])
    plt.xlabel('X')
    plt.ylabel('Y')
    plt.title('Data Set {}'.format(i + 1))
    # Set plot location on screen
    manager = plt.get_current_fig_manager()
    # Grab window dimensions
    x, y, dx, dy = manager.window.geometry().getRect()
示例#5
0
if dist != None:
    print "Subspace Dist  = \n{}".format(dist)
print "Leading Vectors:"
for i in range(m_des):
    print "W[:," + str(i) + "] = \n{}".format(W[:, i])

##################################################
# Plotting
##################################################

if plotting:
    ### Residual sequences
    length = len(Res_full)
    label_len = min(length, 10)
    longest = 0
    colors = linspecer(length)
    sty = '-'
    mkr = 'o'

    fig = plt.figure()
    for i in range(length):
        plt.plot(Res_full[i], color=colors[i], linestyle=sty, marker=mkr)
        longest = max(longest, len(Res_full[i]))

    plt.yscale('log')
    plt.xlim([-0.5, longest + 0.5])
    # Annotation
    plt.title("Residual Sequences: " + title_case)
    plt.xlabel("Iteration")
    plt.ylabel("Residual")
    plt.legend(['Stage ' + str(i + 1) for i in range(label_len)])
示例#6
0
        W_all.append(W_r)
        L_all.append(L_r)
        D_all.append(d_r)
    # Form numpy arrays
    L_all = np.array(L_all)
    D_all = np.array(D_all)

    # Bootstrap analysis
    L_mean = np.array([L_all[:,i].mean() for i in range(L_all.shape[1])])
    L_std  = np.array([L_all[:,i].std() for i in range(L_all.shape[1])])
    D_mean = np.array([D_all[:,i].mean() for i in range(D_all.shape[1])])
    D_std  = np.array([D_all[:,i].std() for i in range(D_all.shape[1])])

    # Plot results
    # --------------------------------------------------
    colors = linspecer(2)
    sig    = 2.                     # Number of sigma to plot as interval

    # Subspace Distance
    ind = range(1,m)
    D_lo= D_mean-D_std*sig; D_lo = [max(d,1e-25) for d in D_lo]
    D_hi= D_mean+D_std*sig

    plt.figure()
    plt.plot(ind,D_mean,color=colors[0],marker='*',linestyle='-')
    plt.fill_between(ind,D_lo,D_hi,alpha=0.5,color=colors[0])
    plt.title('Subspace Distance')
    plt.yscale('log')
    plt.ylim((1e-15,max(D_mean)*10))
    plt.xlim((0,m))
    # Set plot location on screen