コード例 #1
0
ファイル: vg_exp.py プロジェクト: DaomingLyu/lspi
action_traces = []
for i in [91, 93, 95, 97]:
    action_traces.append([j[1] for j in v.single_episode(policy, start=i)])

print action_traces


def costf(a, b):
    return np.abs(a - b)


n = len(action_traces)
ematrix = np.zeros((n, n))
for (i, t) in enumerate(action_traces):
    for (j, s) in enumerate(action_traces):
        ematrix[i, j] = non_dtw_distance(t, s, default=0, costf=costf)

y, s = mds(ematrix)
pylab.clf()
pylab.title("Sensorimotor Distances")
colors = ['red', 'orange', 'green', 'blue']
pts = []
for i in range(4):
    lbl = ""
    if i == 0:
        lbl = "Farthest Object"
    elif i == 3:
        lbl = "Closest Object"
    else:
        lbl = "None"
    print lbl
コード例 #2
0
ファイル: plot.py プロジェクト: stober/lspi
        ematrix = pickle.load(open('ematrix_revised{0}'.format(k)))
        
        y,s = mds(ematrix)
        pylab.clf()
        pylab.title("Iteration {0}".format(k))
        pylab.scatter(y[:,0],y[:,1],c=colors)
        pylab.savefig("embed_{0}".format(k))

if False:
    traces = pickle.load(open('traces13.pck'))
    # find current embedding
    ematrix = np.zeros((512,512))        
    for (i,t) in enumerate(traces):
        for (j,s) in enumerate(traces):
            #ematrix[i,j] = edit_distance_vc([e[1] for e in t], [l[1] for l in s], (1.0, 1.0, 1.5))
            ematrix[i,j] = non_dtw_distance([e[1] for e in t], [l[1] for l in s], default = 8, costf=adist)
    y,s = mds(ematrix)#isomap(ematrix)
    pylab.scatter(y[:,0],y[:,1])
    pylab.show()


if False:
    for (i, y) in enumerate(projections):
        pylab.clf()
        pylab.title("Iteration {0}".format(i))
        pylab.scatter(y[:,0],y[:,1])
        pylab.savefig("embed_{0}".format(i))

if False:
    pylab.clf()
    pylab.title("Embedding Quality")
コード例 #3
0
ファイル: trace_analysis.py プロジェクト: stober/lspi
 def dtw_apply(i, j, t, s):
     return i, j, non_dtw_distance([e[1] for e in t], [l[1] for l in s], costf=cost_func)
コード例 #4
0
ファイル: plot.py プロジェクト: QueensGambit/lspi
        y, s = mds(ematrix)
        pylab.clf()
        pylab.title("Iteration {0}".format(k))
        pylab.scatter(y[:, 0], y[:, 1], c=colors)
        pylab.savefig("embed_{0}".format(k))

if False:
    traces = pickle.load(open('traces13.pck'))
    # find current embedding
    ematrix = np.zeros((512, 512))
    for (i, t) in enumerate(traces):
        for (j, s) in enumerate(traces):
            #ematrix[i,j] = edit_distance_vc([e[1] for e in t], [l[1] for l in s], (1.0, 1.0, 1.5))
            ematrix[i, j] = non_dtw_distance([e[1] for e in t],
                                             [l[1] for l in s],
                                             default=8,
                                             costf=adist)
    y, s = mds(ematrix)  #isomap(ematrix)
    pylab.scatter(y[:, 0], y[:, 1])
    pylab.show()

if False:
    for (i, y) in enumerate(projections):
        pylab.clf()
        pylab.title("Iteration {0}".format(i))
        pylab.scatter(y[:, 0], y[:, 1])
        pylab.savefig("embed_{0}".format(i))

if False:
    pylab.clf()
    pylab.title("Embedding Quality")
コード例 #5
0
ファイル: vg_exp.py プロジェクト: stober/lspi
# test points

action_traces = []
for i in [91,93,95,97]:
    action_traces.append([j[1] for j in v.single_episode(policy, start=i)])

print action_traces

def costf(a,b):
    return np.abs(a-b)

n = len(action_traces)
ematrix = np.zeros((n, n))
for (i, t) in enumerate(action_traces):
    for (j, s) in enumerate(action_traces):
        ematrix[i, j] = non_dtw_distance(t,s,default=0, costf=costf)
    
y,s = mds(ematrix)
pylab.clf()
pylab.title("Sensorimotor Distances")
colors = ['red','orange','green','blue']
pts = []
for i in range(4):
    lbl = ""
    if i == 0:
        lbl = "Farthest Object"
    elif i == 3:
        lbl = "Closest Object"
    else:
        lbl = "None"
    print lbl
コード例 #6
0
ファイル: trace_analysis.py プロジェクト: QueensGambit/lspi
 def dtw_apply(i, j, t, s):
     return i, j, non_dtw_distance([e[1] for e in t], [l[1] for l in s],
                                   costf=cost_func)