Segment Set Definition

The first step in creating a MR-HMM is the definition of the segment set. The code:
   K     =    16; % base segment size
   Ns    =   [ 16  32  48  64    96   128   192     256      384     768 ];
   nfeat = length(Ns);
   shfts=K*ones(1,nfeat);
Defines the base segment size K to be 16 samples. The array Ns contains the segment sizes that are to be used. Note that all entries in Ns must be divisible by K. Variable shtfs defines the segment time shifting quantizaion in samples. A smaller shift (in increments of K samples) means more overlap between time updates. When in doubt, use shfts=K*ones(1,nfeat); which specifies that all segment sizes will be computed with K samples of shift.

Note that any segmentation of the time-series must consist of segments selected from Ns. The more segmentations are possible, the better. To this end, it is better, but not necessary, to truncate the data to the least common multiple of the elements of Ns:

   % find least common multiple
   max_segment_size=Ns(1);
   for i=2:nfeat,
        max_segment_size=lcm(max_segment_size,Ns(i));
   end;
   fprintf('max_segment_size=',%d\n',max_segment_size=);

   % truncate the data to a multiple of max_segment_size
   for i=1:length(X),
     n=floor(length(X{i})/max_segment_size)*max_segment_size;
     X{i}=X{i}(1:n);
     ntot(i)=n;
   end;