CompressPURPOSEGaussian mixutre compression.
SYNOPSISfunction gmC=Compress(gm,m)
DESCRIPTIONGaussian mixutre compression. Compresses a Gaussian mixture so that it includes only 'm' components. We first remove components with tiny weigth and then we apply the compression by Goldberger and Roweis (see Appendix A in the paper). Note that this can be applied to both normalized and unnormalized mixtures. Both Gaussian-based beliefs and alpha-elements are compressed. So, this is one of the fundamental methods of this toolbox. Any improvement in this function results in a large speed up in the global planner. CROSS-REFERENCE INFORMATIONThis function calls:
SOURCE CODE0001 function gmC=Compress(gm,m) 0002 % Gaussian mixutre compression. 0003 % 0004 % Compresses a Gaussian mixture so that it includes only 'm' components. 0005 % We first remove components with tiny weigth and then we apply the 0006 % compression by Goldberger and Roweis (see Appendix A in the paper). 0007 % 0008 % Note that this can be applied to both normalized and unnormalized 0009 % mixtures. 0010 % 0011 % Both Gaussian-based beliefs and alpha-elements are compressed. So, this 0012 % is one of the fundamental methods of this toolbox. Any improvement in 0013 % this function results in a large speed up in the global planner. 0014 0015 if (gm.n<=m) || (m==0) % if gmC is not already compressed or not to be compressed 0016 gmC=gm; 0017 else 0018 % This is to ensure all weights are positive, in [0,1], and sum 1 0019 gmN=Normalize(gm); 0020 0021 % Remove remove non-important components (to speed up next step) 0022 % - gmLC is the sub-set of gmN with relemant components 0023 % - mapLC is the index of the elements of gmN used to form gmLC 0024 [gmLC mapLC]=RemoveSmallComponents(gmN,0.1/gmN.n); 0025 0026 % Use the Goldberger and Roweis compression 0027 % - gmC is the compressed mixture 0028 % - mapC are pointers from eleements in gmLC to elements in gmC 0029 % (this allow to identify the elements in gmLC aggregated to form 0030 % an element in gmC) 0031 [gmC mapC]=CompressGR(Normalize(gmLC),m,1e-5,50); 0032 0033 % Recover the original weigths summing the weights of the input 0034 % components assigned to each output component 0035 gmC.w=zeros(1,gmC.n); 0036 for i=1:gmC.n 0037 ndx=(mapC==i); 0038 gmC.w(i)=sum(gm.w(mapLC(ndx))); 0039 end 0040 0041 % Caution: at this point gmC is not normalized any more 0042 gmC=RemoveSmallComponents(gmC,1e-3); 0043 end |