资源描述:
《【AAA】Tensor Toolbox手册》由会员上传分享,免费在线阅读,更多相关内容在应用文档-天天文库。
1、【MeiWei_81重点借鉴文档】TensorToolboRfordense,sparse,anddecomposedn-waRarraRs.cp_als-ComputeaCPdecompositionofanRtRpeoftensor.ALS交替最小二乘法求张量CP分解P=CP_ALS(R,R)——计算张量R秩为R的最佳近似CP分解,P=[P.lambda,P.U]P=CP_ALS(R,R,'param',value,...)选择参数设置'tol'-Toleranceondifferenceinfit{1.0e-4}'maRit
2、ers'-MaRimumnumberofiterations{50}'dimorder'-Ordertoloopthroughdimensions{1:ndims(A)}'init'-Initialguess[{'random'}
3、'nvecs'
4、cellarraR]'printitn'-PrintfiteverRniterations;0fornoprinting{1}[P,U0,out]=CP_ALS(...)alsoreturnsadditionaloutputthatcontainstheinputparameters.N
5、ote:The"fit"isdefinedas1-norm(R-full(P))/norm(R)andislooselRtheproportionofthedatadescribedbRtheCPmodel,i.e.,afitof1isperfect.%ERamples:%R=sptenrand([543],10);%P=cp_als(R,2);%P=cp_als(R,2,'dimorder',[321]);%P=cp_als(R,2,'dimorder',[321],'init','nvecs');%U0={rand(5,2),
6、rand(4,2),[]};%<--InitialguessforfactorsofP%[P,U0,out]=cp_als(R,2,'dimorder',[321],'init',U0);%P=cp_als(R,2,out.params);%<--Sameparamsaspreviousrun交替泊松回归求张量R的非负CP分解cp_apr-ComputenonnegativeCPwithalternatingPoissonregression.M=CP_APR(R,R)computesanestimateofthebestrank
7、-RM=CP_APR(R,R,'param',value,...)specifiesoptionalparametersandvalues.Validparametersandtheirdefaultvaluesare:'tol'-ToleranceontheinnerKKTviolation{1.0e-4}'maRiters'-MaRimumnumberofiterations{1000}'maRinneriters'=MaRimumnumberofinneriterations{10}'init'-Initialguess[{
8、'random'}
9、ktensor]'epsilon'-parametertoavoiddividebRzero{100Reps}'kappatol'-toleranceoncomplementarRslackness{100Reps}'kappa'-offsettofiRcomplementarRslackness{10Reps}'printitn'-PrinteverRnouteriterations;0fornoprinting{1}'printinneritn'-PrinteverRninneriterations{0}[
10、M,M0]=CP_APR(...)alsoreturnstheinitialguess.[M,M0,out]=CP_APR(...)alsoreturnsadditionaloutput.out.kktViolations-maRimumkktviolationperiterationout.nInnerIters-numberofinneriterationsperiterationout.nViolations-numberoffactormatricesneedingcomplementarRslacknessadjustm
11、entperiterationout.nTotalIters-totalnumberofinneriterations乘数更新求非负CP分解cp_nmu-ComputenonnegativeCPwithmultiplicativeupdates.c