예제 #1
0
kernel = [kindex, prior, sprior]

fnames = ["../cache/fith/PI{}.p".format(i) for i in xrange(5)]
statesPI = search.multiPESIPS(ojfa, lb, ub, kernel, 10, fnames)

x = []
y = []
for stateEI in statesEI:
    a[2].plot(stateEI[11], 'r')
    #a[3].plot([sum(stateEI[5][:i]) for i in xrange(len(stateEI[5]))],stateEI[11],'r')
    x.append([sum(stateEI[5][:i]) for i in xrange(len(stateEI[5]))])
    y.append(stateEI[11].flatten())
    print 'reccomended under EI: {} : {}'.format(
        [10**i for i in stateEI[4][-1]],
        ojf(stateEI[4][-1], None, None)[0])
X_, Y_, lb_, ub_ = OPTutils.mergelines(x, y)
a[3].fill_between(X_,
                  lb_,
                  ub_,
                  facecolor='lightcoral',
                  edgecolor='lightcoral',
                  alpha=0.5)
a[3].plot(X_, Y_, 'r')

x = []
y = []
for statePE in statesPE:
    a[2].plot(statePE[11], 'b')
    #a[3].plot([sum(statePE[5][:i]) for i in xrange(len(statePE[5]))],statePE[11],'b')
    x.append([sum(statePE[5][:i]) for i in xrange(len(statePE[5]))])
    y.append(statePE[11].flatten())
예제 #2
0
lsu = 3
lsl = -7
names = ["../cache/braninnoise/PESVS_"+str(int(100*sp.log10(s)))+"_"+str(pwr)+"_"+str(i)+"_"+str(lsl)+"_"+str(lsu)+".p" for i in xrange(nreps)]
results = search.multiPESVS(ojf,lb,ub,kernel,s,bd,lambda x,s:cfn(s),lsl,lsu,names)
Rz = [sp.log10(sp.array(r[11])-braninmin).flatten() for r in results]
Cz = [[sum(r[5][:j]) for j in xrange(len(r[5]))] for r in results]
#for i in xrange(nreps):
#    a[2].plot(Cz[i],Rz[i].flatten(),'rx-')
#[a[1].semilogy([1e-6/(c**(1./pwr)) for c in r[5]],'cyan') for r in results]
x=[]
y=[]
for r in results:
    y.append(sp.array(sp.log10([1e-6/(c**(1./pwr)) for c in r[5]])))
    print y
    x.append(range(len(r[5])))
X_,Y_,lb_,ub_ = OPTutils.mergelines(x,y)
a[1].fill_between(X_,lb_,ub_,facecolor='lightcoral',edgecolor='lightcoral',alpha=0.5)
a[1].plot(X_,Y_,'r')
    #a[2].plot(sp.array([sum(C2[:j]) for j in xrange(len(C2))]).flatten(),(sp.log(Yreg)).flatten(),'ro-')


def linint(i,c):
    if c>Cz[i][-1]:
        return sp.NaN
    else:
        j=0
        while Cz[i][j]<c:
            j+=1
    return Rz[i][j-1]+(c-Cz[i][j-1])*(Rz[i][j]-Rz[i][j-1])/(Cz[i][j]-Cz[i][j-1])

#for i in xrange(nreps):
예제 #3
0
#!/usr/bin/env python2
#encoding: UTF-8

# To change this license header, choose License Headers in Project Properties.
# To change this template file, choose Tools | Templates
# and open the template in the editor.

import scipy as sp
from matplotlib import pyplot as plt

n=12
def f(x):
    return 0.1*x**2-0.5*x+1.+0.1*(0.2*abs(x)+1)*sp.random.normal()
r=[]
y=[]
for i in xrange(n):
    r.append(sorted(sp.random.uniform(0,10,40)))
    y.append(map(f,r[-1]))
    plt.plot(r[-1],y[-1],'c')

import OPTutils

X,Y,lb,ub = OPTutils.mergelines(r,y)
    
plt.fill_between(X,lb,ub,facecolor='lightgreen')
plt.plot(X,Y)
plt.show()
예제 #4
0
#encoding: UTF-8

# To change this license header, choose License Headers in Project Properties.
# To change this template file, choose Tools | Templates
# and open the template in the editor.

import scipy as sp
from matplotlib import pyplot as plt

n = 12


def f(x):
    return 0.1 * x**2 - 0.5 * x + 1. + 0.1 * (0.2 * abs(x) +
                                              1) * sp.random.normal()


r = []
y = []
for i in xrange(n):
    r.append(sorted(sp.random.uniform(0, 10, 40)))
    y.append(map(f, r[-1]))
    plt.plot(r[-1], y[-1], 'c')

import OPTutils

X, Y, lb, ub = OPTutils.mergelines(r, y)

plt.fill_between(X, lb, ub, facecolor='lightgreen')
plt.plot(X, Y)
plt.show()