代理模型

pydacefit的Python项目详细描述


Pydacefit

文档可在以下位置找到: https://www.egr.msu.edu/coinlab/blankjul/pydacefit/

此克隆的目的是在Matlab中使用流行的DaceFit工具箱的Python版本。 工具箱可以找到here

此框架是原始代码的精确克隆,并已检查其正确性。 请联系我,如果你的情况下,值是明显不同(10^6)。

安装

测试问题被上传到pypi存储库。

pip install pydacefit

用法

importnumpyasnpfrompydacefit.corrimportcorr_gauss,corr_cubic,corr_exp,corr_expg,corr_spline,corr_sphericalfrompydacefit.daceimportDACE,regr_linear,regr_quadraticfrompydacefit.regrimportregr_constantimportmatplotlib.pyplotasplt# -----------------------------------------------# Different ways of initialization# -----------------------------------------------# regression can be: regr_constant, regr_linear or regr_quadraticregression=regr_constant# regression = regr_linear# regression = regr_quadratic# then define the correlation (all possible correlations are shown below)# please have a look at the MATLAB document for more detailscorrelation=corr_gauss# correlation = corr_cubic# correlation = corr_exp# correlation = corr_expg# correlation = corr_spline# correlation = corr_spherical# correlation = corr_cubic# This initializes a DACEFIT objective using the provided regression and correlation# because an initial theta is provided and also thetaL and thetaU the hyper parameter# optimization is donedacefit=DACE(regr=regression,corr=correlation,theta=1.0,thetaL=0.00001,thetaU=100)# if no lower and upper bounds are defined, then no hyperparameter optimization is executeddacefit_no_hyperparameter_optimization=DACE(regr=regression,corr=correlation,theta=1.0,thetaL=None,thetaU=None)# to turn on the automatic relevance detection use a vector for theta and define boundsdacefit_with_ard=DACE(regr=regression,corr=correlation,theta=[1.0,1.0],thetaL=[0.001,0.0001],thetaU=[20,20])# -----------------------------------------------# Create some data for the purpose of testing# -----------------------------------------------deffun(X):returnnp.sum(np.sin(X*2*np.pi),axis=1)X=np.random.random((20,1))F=fun(X)# -----------------------------------------------# Fit the model with the data and predict# -----------------------------------------------# create the model and fit itdacefit.fit(X,F)# predict values for plotting_X=np.linspace(0,1,100)[:,None]_F=dacefit.predict(_X)# -----------------------------------------------# Plot the results# -----------------------------------------------plt.scatter(X,F,label="prediction")plt.plot(_X,_F,label="data")plt.legend()plt.show()print("MSE: ",np.mean(np.abs(fun(_X)[:,None]-_F)))

热门话题
具有未知数量条件的java If语句   java如何在Spark中使用两个“条件”进行过滤?   雅加达ee为ColdFusion提供的最佳Java ee服务器   java如何在jersey的MessageBodyWriter方法中获取writeTo中的anotations值?   java从脚本文件调用jar文件中的函数   java在执行insert语句后,如何获得id值为的语句?   在OS X上设置OpenCV Java绑定   java使用for循环遍历数组x。以字符串形式返回x的元素,其中每个元素由一个空格分隔   ApacheiClientBuilder为Algolia Java创建的APIClient是线程安全的吗?   java在DFS/BFS算法中获取邻居时避免内存分配?   java使用AES/CBC/PKCS5P加密大文件(2GB)   允许保存/加载列布局的Java DB网格组件   队列大小为1的java Spring调度   跑步带有Java参数的exe   java正则表达式将所有“<”和“>”标记替换为“&lt;”及“&gt;”在<<![CDATA]>标签?   java何时同步变量?