CS计算机代考程序代写 In [136]:

In [136]:
import scipy.stats as spst
import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline

Optimization question
Minimize $-(3x-3)^3+(x+20)^3$, where $-10-10) * (x_s<10)] #choose the top 10 samples with the highest EI x_new=x_s[np.argsort(good_kernel(x_s)/bad_kernel(x_s))[-10:]] y_new=-(3*x_new-3)**3+(x_new+20)**3 x=np.append(x,x_new) y=np.append(y,y_new) N=N+10 #update good and bad samples good=x[np.argsort(y)[0:int(N*0.3)]] bad=x[np.argsort(y)[int(N*0.3):]] good_kernel=kernel(good) bad_kernel=kernel(bad) In [144]: x[np.argmin(y)],np.min(y) In [145]: In [146]: