您好,欢迎访问三七文档
当前位置:首页 > 商业/管理/HR > 销售管理 > TensorToolbox手册
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'-Ordertoloopthroughdimensions{1:ndims(A)}'init'-Initialguess[{'random'}|'nvecs'|cellarray]'printitn'-Printfiteveryniterations;0fornoprinting{1}[P,U0,out]=CP_ALS(...)alsoreturnsadditionaloutputthatcontainstheinputparameters.Note:Thefitisdefinedas1-norm(X-full(P))/norm(X)andislooselytheproportionofthedatadescribedbytheCPmodel,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(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'-ToleranceontheinnerKKTviolation{1.0e-4}'maxiters'-Maximumnumberofiterations{1000}'maxinneriters'=Maximumnumberofinneriterations{10}'init'-Initialguess[{'random'}|ktensor]'epsilon'-parametertoavoiddividebyzero{100*eps}'kappatol'-toleranceoncomplementaryslackness{100*eps}'kappa'-offsettofixcomplementaryslackness{10*eps}'printitn'-Printeverynouteriterations;0fornoprinting{1}'printinneritn'-Printeveryninneriterations{0}[M,M0]=CP_APR(...)alsoreturnstheinitialguess.[M,M0,out]=CP_APR(...)alsoreturnsadditionaloutput.out.kktViolations-maximumkktviolationperiterationout.nInnerIters-numberofinneriterationsperiterationout.nViolations-numberoffactormatricesneedingcomplementaryslacknessadjustmentperiterationout.nTotalIters-totalnumberofinneriterations乘数更新求非负CP分解cp_nmu-ComputenonnegativeCPwithmultiplicativeupdates.cp_opt-FitsaCPmodeltoatensorviaoptimization.cp_wopt-FitsaweightedCPmodeltoatensorviaoptimization.create_guess-CreatesinitialguessforCPorTuckerfitting.create_problem-Createtestproblemsfortensorfactorizations.export_data-Exporttensor-relateddatatoafile.import_data-Importtensor-relateddatatoafile.khatrirao-Khatri-Raoproductofmatrices.Y=khatrirao(A,B)计算具有相同列数的矩阵A和B的khatri-rao积[KRON(A(:,1),B(:,1))...KRON(A(:,n),B(:,n))]khatrirao(A1,A2,...)computestheKhatri-Raoproductofmultiplematricesthathavethesamenumberofcolumns.khatrirao(C)computestheKhatri-RaoproductofthematricesincellarrayC.khatrirao(...,'r')computestheKhatri-Raoproductinreverseorder.%ExamplesA=rand(5,2);B=rand(3,2);C=rand(2,2);khatrirao(A,B)%--Khatri-RaoofAandBkhatrirao(B,A,'r')%--samethingasabovekhatrirao({C,B,A})%--passingacellarraykhatrirao({A,B,C},'r')%--sameasaboveparafac_als-Deprecated.UseCP_ALSinstead.sptendiag-Createsasparsetensorwithvonthediagonal.构造稀疏均匀分布随机张量sptenrand-Sparseuniformlydistributedrandomtensor.R=sptenrand(sz,density)createsarandomsparsetensorofthespecifiedszwithapproximatelydensity*prod(sz)nonzeroentries.R=sptanrand(sz,nz)createsarandomsparsetensorofthespecifiedszwithapproximatelynznonzeroentries.%Example:R=sptenrand([542],12);sshopm-Shiftedpowermethodforfindingarealeigenpairofarealtensor.sshopmc-Shiftedpowermethodforreal/complexeigenpairofarealtensor.tendiag-Createsatensorwithvonthediagonal.teneye-Createidentitytensorofspecifiedsize.tenones-Onestensor.tenrand-Uniformlydistributedpseudo-randomtensor.tenzeros-Createzerostensor.HOOI算法做张量Tucker分解tucker_als-Higher-orderorthogonaliteration.T=TUCKER_ALS(X,R)computesthebestrank-(R1,R2,..,Rn)approximationoftensorX,accordingtothespecifieddimensionsinvectorR.TheinputXcanbeatensor,sptensor,ktensor,orttensor.TheresultreturnedinTisattensor.T=TUCKER_ALS(X,R,'param',value,...)specifiesoptionalparametersandvalues.Validparametersandtheirdefaultvaluesare:'tol'-Toleranceondifferenceinfit{1.0e-4}'maxiters'-Maximumnumberofiterations{50}'dimorder'-Ordertoloopthroughdimensions{1:ndims(A)}'init'-Initialguess[{'random'}|'nvecs'|cellarray]'printitn'-Printfiteveryniterations{1}[T,U0]=TUCKER_ALS(...)alsoreturnstheinitialguess.%Examples:%X=sptenrand([543],10);%T=tucker_als(X,2);%--bestrank(2,2,2)approximation%T=tucker_als(X,[221]);%--bestrank(2,2,1)approximation%T=tucker_als(X,2,'dimorder',[321]);%T=tucker_als(X,2,'dimorder',[321],'init','nvecs');%U0={rand(5,2),rand(4,2),[]};%--InitialguessforfactorsofT%T=tucker_als(X,2,'dimorder',[321],'init',U0);@TENSORand-LogicalAND(&)fortensors.collapse-Collapsetensoralongspecifieddimensions.contract-Contracttensoralongtwodimensions(arraytrace).ctranspose-isnotdefinedfortensors.disp-Commandwindowdisplayofatensor.display-Commandwindowdisplayofatensor.double-Converttensortodoublearray.end-Lastindexofindexingexpressionfortensor.eq-Equal(==)fortensors.find-Findsubscriptsofnonzeroelementsinatensor.full-Converttoa(dense)tensor.ge-Greaterthanorequal(=)fortensors.gt-Greaterthan()fortensors.innerprod-Efficientinnerproductwithatensor.
本文标题:TensorToolbox手册
链接地址:https://www.777doc.com/doc-2862730 .html