最常用的偏最小二乘多块算法的实现
mbpls的Python项目详细描述
一个易于使用的python包,用于(多块)偏最小二乘 单变量或多变量结果的预测模型。四州 已经实现并优化了最先进的算法 在大数据矩阵上的性能。这个包裹被设计成 能够处理丢失的数据,从而使应用程序向前 利用scikit学习api及其模型选择 工具箱。
文档可在https://mbpls.readthedocs.io找到 详细的(现实世界的)jupyter笔记本示例可以在 https://github.com/DTUComputeStatisticsAndDataAnalysis/MBPLS/tree/master/examples
可以使用以下引用引用此包。
baum等人(2019年)。多块pls:python的块相关预测建模。开源软件杂志,4(34),1190
安装
- 使用以下命令安装python3的包。一些 依赖项可能需要升级(scikit learn、numpy和 scipy)。$ pip install mbpls
- 现在您可以通过键入导入mbpls类from mbpls.mbpls import MBPLS
快速启动
使用mbpls包进行偏最小二乘(pls)预测建模
importnumpyasnpfrommbpls.mbplsimportMBPLSnum_samples=40num_features=200# Generate random data matrix Xx=np.random.rand(num_samples,num_features)# Generate random reference vector yy=np.random.rand(num_samples,1)# Establish prediction model using 2 latent variables (components)pls=MBPLS(n_components=2)pls.fit(x,y)y_pred=pls.predict(x)
多块偏最小二乘(mb-pls)预测模型的mbpls包
importnumpyasnpfrommbpls.mbplsimportMBPLSnum_samples=40num_features_x1=200num_features_x2=250# Generate two random data matrices X1 and X2 (two blocks)x1=np.random.rand(num_samples,num_features_x1)x2=np.random.rand(num_samples,num_features_x2)# Generate random reference vector yy=np.random.rand(num_samples,1)# Establish prediction model using 3 latent variables (components)mbpls=MBPLS(n_components=3)mbpls.fit([x1,x2],y)y_pred=mbpls.predict([x1,x2])# Use built-in plot method for exploratory analysis of multiblock pls modelsmbpls.plot(num_components=3)