作为python工具箱的计算实验设计与分析。

pydace的Python项目详细描述


说明

本项目改编自汉斯·布鲁恩·尼尔森、S_ren Nymand和Lophaven Jacob S_ndergaard的作品。

注释

这是一个非常依赖线性代数解算器的实现(最小二乘解算器、Cholesky和QR 分解等)因此,强烈建议您的numpy库集成到 BLAS library(例如:英特尔MKL、OpenBLAS、ATLAS等) 以达到满意的计算性能。

为了方便起见,Anaconda处理了如何将numpy与那些库结合起来的细节

安装

通过pypi存储库安装:

pip install pydace

通过conda安装

conda install -c felipes21 pydace

用法

DACE模型示例

importnumpyasnpimportscipy.ioassiofrompydaceimportDaceimportmatplotlib.pyplotasplt# Load the training and validation data. (Here we are using a file from the# github repo located in the folder pydace\tests with the name # 'doe_final_infill_mat'mat_contents=sio.loadmat('doe_final_infill.mat')design_data=mat_contents['MV']# design sitesobserved_data=mat_contents['CV']# experiment results# define the hyperparameters bounds and initial estimatetheta0=1*np.ones((design_data.shape[1],))lob=1e-5*np.ones(theta0.shape)upb=1e5*np.ones(theta0.shape)# select the training and validation datadesign_val=design_data[:99,:]observed_val=observed_data[:99,:]design_train=design_data[100:,:]observed_train=observed_data[100:,:]# build the univariate kriging models with a first order polynomial # regression and a gaussian regression modelobserved_prediction=np.empty(observed_val.shape)forjinnp.arange(design_data.shape[1]):# initialize the dace objectdace_obj=Dace('poly1','corrgauss',optimizer='boxmin')# fit the training data using the default hyperparameter optimizerdace_obj.fit(design_train,observed_train[:,j],theta0,lob,upb)# predict the validation dataobserved_prediction[:,[j]],*_=dace_obj.predict(design_val)# labels for the observed datavar_labels=['L/F','V/F','xD','xB','J','QR']# plot the validation dataforvarinnp.arange(design_data.shape[1]):plt.figure(var+1)plt.plot(observed_val[:,var],observed_prediction[:,var],'b+')plt.xlabel(var_labels[var]+' - Observed')plt.ylabel(var_labels[var]+' - Kriging Prediction')plt.show()

实验数据生成设计示例

利用拉丁超立方体的变异减少技术也可以生成实验数据的设计 已在此工具箱中实现的采样(lhs)。

假设我们有一个4维问题(即4个设计/输入变量)。它们由以下界限定义。

Variables to sample

如果我们想在这些边界内建立一个拉丁超立方体,我们将执行以下操作:

importnumpyasnpfrompydace.aux_functionsimportlhsdesignlb=np.array([8.5,0.,102.,0.])ub=np.array([20.,100.,400.,400.])lhs=lhsdesign(53,lb,ub,include_vertices=False)

与我联系/交谈

我的电子邮件是felipe.lima@eq.ufcg.edu.br。随时都可以联系我,如果我懒的话就唠叨我。

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java嵌套循环打印一个数字,旁边有相同数量的星号   java JodReports替代方案   java如何将模型类parcelable对象从片段传递到活动?   java JCS缓存删除功能不删除特定元素   如何打开。Java的dll文件。   java在这种情况下如何选择聚合根?   java从CellEditorListener获取编辑的TreeNode   Java到web服务和mysql   从openssl ec在Java中创建公钥时出现加密无效密钥异常   Java数组:添加多个数组的元素时忽略空数组   java在初始化后向fragment发送数据   JButtons的java数组正在返回void   若联接列不包含特定值,则java JPA条件生成器仅返回实体   java ActionBar问题:NPE   java Portlet是被广泛使用还是非常罕见?