资源描述:
《tensor toolbox手册范本》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、TensorToolboxfordense,sparse,anddecomposedn-wayarrays.cp_als-ComputeaCPdecompositionofanytypeoftensor.ALS交替最小二乘法求张量CP分解P=CP_ALS(X,R)——计算张量X秩为R的最佳近似CP分解,P=[P.lambda,P.U]P=CP_ALS(X,R,'param',value,...)选择参数设置'tol'-Toleranceondifferenceinfit{1.0e-4}'maxiters'-Maximumnumberofiterations{50}'dimorder'-O
2、rdertoloopthroughdimensions{1:ndims(A)}'init'-Initialguess[{'random'}
3、'nvecs'
4、cellarray]'printitn'-Printfiteveryniterations;0fornoprinting{1}[P,U0,out]=CP_ALS(...)alsoreturnsadditionaloutputthatcontainstheinputparameters.Note:The"fit"isdefinedas1-norm(X-full(P))/norm(X)andislooselytheproportionof
5、thedatadescribedbytheCPmodel,i.e.,afitof1isperfect.%Examples:%X=sptenrand([543],10);%P=cp_als(X,2);%P=cp_als(X,2,'dimorder',[321]);%P=cp_als(X,2,'dimorder',[321],'init','nvecs');%U0={rand(5,2),rand(4,2),[]};%<--InitialguessforfactorsofP%[P,U0,out]=cp_als(X,2,'dimorder',[321],'init',U0);%P=cp_als(
6、X,2,out.params);%<--Sameparamsaspreviousrun交替泊松回归求张量X的非负CP分解cp_apr-ComputenonnegativeCPwithalternatingPoissonregression.M=CP_APR(X,R)computesanestimateofthebestrank-RM=CP_APR(X,R,'param',value,...)specifiesoptionalparametersandvalues.Validparametersandtheirdefaultvaluesare:'tol'-Toleranceontheinn
7、erKKTviolation{1.0e-4}'maxiters'-Maximumnumberofiterations{1000}'maxinneriters'=Maximumnumberofinneriterations{10}'init'-Initialguess[{'random'}
8、ktensor]'epsilon'-parametertoavoiddividebyzero{100*eps}'kappatol'-toleranceoncomplementaryslackness{100*eps}'kappa'-offsettofixcomplementaryslackness{10
9、*eps}'printitn'-Printeverynouteriterations;0fornoprinting{1}'printinneritn'-Printeveryninneriterations{0}[M,M0]=CP_APR(...)alsoreturnstheinitialguess.[M,M0,out]=CP_APR(...)alsoreturnsadditionaloutput.out.kktViolations-maximumkktviolationperiterationout.nInnerIters-numberofinneriterationsperiterat
10、ionout.nViolations-numberoffactormatricesneedingcomplementaryslacknessadjustmentperiterationout.nTotalIters-totalnumberofinneriterations乘数更新求非负CP分解cp_nmu-ComputenonnegativeCPwithmultiplicativeupdates.cp_opt-FitsaCPmode