Home > manopt > manifolds > ttfixedrank > TTeMPS_1.1 > examples > ex_completion_rankadaptive.m

ex_completion_rankadaptive

PURPOSE ^

Example script for RANK-ADAPTIVE TENSOR COMPLETION, see Algorithm RTTC described in

SYNOPSIS ^

This is a script file.

DESCRIPTION ^

 Example script for RANK-ADAPTIVE TENSOR COMPLETION, see Algorithm RTTC described in  

   Michael Steinlechner, Riemannian optimization for high-dimensional tensor completion,
   Technical report, March 2015, revised December 2015. 
   To appear in SIAM J. Sci. Comput. 

 See this report for more details about the algorithms and the setup. 
 In particular, the choices of 
   
   maxiter, maxiter_final,
   tol, reltol, gradtol

 can significantly influence the performance. They have to be chosen in such a
 way so that the algorithm does not stay too long at each intermediate rank
 (usually, less than 10 iteration per intermediate rank suffice completely).
 The correct choice requires some testing w.r.t. to the underlying data.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 % Example script for RANK-ADAPTIVE TENSOR COMPLETION, see Algorithm RTTC described in
0002 %
0003 %   Michael Steinlechner, Riemannian optimization for high-dimensional tensor completion,
0004 %   Technical report, March 2015, revised December 2015.
0005 %   To appear in SIAM J. Sci. Comput.
0006 %
0007 % See this report for more details about the algorithms and the setup.
0008 % In particular, the choices of
0009 %
0010 %   maxiter, maxiter_final,
0011 %   tol, reltol, gradtol
0012 %
0013 % can significantly influence the performance. They have to be chosen in such a
0014 % way so that the algorithm does not stay too long at each intermediate rank
0015 % (usually, less than 10 iteration per intermediate rank suffice completely).
0016 % The correct choice requires some testing w.r.t. to the underlying data.
0017 
0018 %   TTeMPS Toolbox.
0019 %   Michael Steinlechner, 2013-2016
0020 %   Questions and contact: michael.steinlechner@epfl.ch
0021 %   BSD 2-clause license, see LICENSE.txt
0022 
0023 rng(17);
0024 
0025 d = 5;
0026 nn = 20;
0027 maxrank = 7;
0028 L = 1;
0029 
0030 n = nn*ones(1,d);
0031 
0032 opts_cg = struct('maxiter', 10,'maxiter_final',10, 'tol', 1e-6, 'reltol', 1e-6, 'gradtol', 0, 'maxrank', maxrank,'epsilon',1e-8);
0033 
0034 dof = d*nn*maxrank^2;
0035 sizeOmega = 10*dof;
0036 sizeGamma = sizeOmega;
0037 
0038 Omega = makeOmegaSet_mod(n, sizeOmega);
0039 sizeOmega_C = 100;
0040 sizeOmega = sizeOmega - sizeOmega_C;
0041 Omega_C_ind = randperm( sizeOmega, sizeOmega_C );
0042 Omega_C = Omega( Omega_C_ind, : );
0043 Omega( Omega_C_ind, : ) = [];
0044 Gamma = makeOmegaSet_mod(n, sizeGamma);
0045 
0046 A_Omega = zeros(sizeOmega,1);
0047 A_Omega_C = zeros(sizeOmega_C,1);
0048 A_Gamma = zeros(sizeGamma,1);
0049 
0050 f = @(x) exp(-norm(x));
0051 
0052 for i = 1:sizeOmega
0053     A_Omega(i) = f( Omega(i,:)/(max(n)-1)*L );
0054 end
0055 for i = 1:sizeOmega_C
0056     A_Omega_C(i) = f( Omega_C(i,:)/(max(n)-1)*L );
0057 end
0058 for i = 1:sizeGamma
0059     A_Gamma(i) = f( Gamma(i,:)/(max(n)-1)*L );
0060 end
0061 
0062 r = [1, 1*ones(1,d-1), 1];
0063 X0 = TTeMPS_rand( r, n );
0064 X0 = orthogonalize( X0, X0.order );
0065 
0066 [X,cost,test,stats] = completion_rankincrease( 'GeomCG', A_Omega, Omega, A_Omega_C, Omega_C, A_Gamma, Gamma, X0, opts_cg );
0067 
0068 stats.rankidx = cumsum(stats.rankidx)
0069 subplot(1,2,1)
0070 semilogy( 1:length(cost), cost,'Markersize',8);
0071 hold on
0072 line = [1e-6,1e0];
0073 for i=1:length(stats.rankidx)
0074     semilogy( [stats.rankidx(i), stats.rankidx(i)], line, '--','color',[0.7,0.7,0.7]);
0075 end
0076 title('Reduction of cost function')
0077 xlabel('Number of individual RTTC iterations performed')
0078 ylabel('Cost function')
0079 legend('Cost function','rank increase in one mode')
0080 set(gca,'fontsize',16)
0081 
0082 subplot(1,2,2)
0083 semilogy( 1:length(test), test,'Markersize',8);
0084 title('Reduction of rel. error on test set')
0085 xlabel('Number of full RTTC runs')
0086 ylabel('Rel. error after one RTTC run for a certain rank')
0087 set(gca,'fontsize',16)

Generated on Fri 30-Sep-2022 13:18:25 by m2html © 2005