Implementation: Circular and Non-Circular Autocorrelation

An important feature set for the analysis of quasi-stationary processes is the ACF. Because of their efficiency and tractabity, much of our attention has been directed toward circularly stationary spectral models (i.e. feature extraction starting with FFT). Therefore, we have described methods of extracting ACF using the FFT as a first step in Sections 5.2.2, 5.2.5, 5.2.8, and 5.3.3. See these sections for implementation information of circular ACF. But, when block segmentation is used (See section 12.1) , or for MR-HMM (Chapter 14), we recommend against the FFT-based approaches. Unless measures are taken to prevent circular discontinuities it is preferable to use non-circular ACF features for the analysis and classification of quasi-stationary processes (See Section 9.1.5). We have seen in Sections 8.1.3 and 8.1.3 above, how to set up matrices $ {\bf P}_i$ in order to compute both the non-circular and circular ACF. The non-circular ACF is implemented by feature module software/module_acfx.m. We now explain the working of this module.

The module first implements the construction of matrices $ {\bf P}_i$ exactly as described above. Then, since the zero lag output $ r_0$ is the sample variance, we are able to implement data normalization as a floating reference hypothesis (See Section 2.3.4). The function software/pdf_quadspa.m implements the log-PDF of ACF feature $ {\tt r}$ under hypothesis $ H_0$ of independent Gaussian noise of variance 1. Using equation (2.17) directly, we can write the J-function for the feature $ {\tt r}$ as using the floating-variance reference hypothesis $ H_v$ as

 
  % the variance estimate for normalization
  v=mean(x.^2); 
  
  % The PDF of x under floating hypothesis Hv:
  lpxHv = -N/2*log(2*pi*v) - sum(x.^2,1)/2/v;

  % The PDF of r under floating hypothesis Hv:
  lprHv=pdf_quadspa(r/v,Pm,level)+(P+1)*log(v)

  jout = jin + lpxHv - lprHv

We can float the reference hypothesis even closer to the data by changing the assumed covariance of the reference hypothesis. If we base the covariance on the feature r, we must use the autoregressive assumption to extend the covariance beyond the $ P$-th lag. We then use equation (8.2) to modify the matrices $ {\bf P}_i$. That is all accomplished by the following code extract:

 
    % compute extended ACF using AR:
    [a,e]=levinson(r,P);
    pa=e./msq(fft(a,2*N));
    ra=real(ifft(pa));

    % normalize to have variance 1
    e=e/ra(1);
    ra=ra/ra(1);

    % create the ACF matrix:
    R=toeplitz(ra(1:N));
    ldr=log(det(R));

    % Modify the quadratic form matrices 
    C=chol(R);
    for i=1:P+1,
      Pm(:,:,i) = C* Pm(:,:,i) * C';
    end;

The PDF of $ {\bf x}$ under $ H_r$ must also be used

 
   xt=x/sqrt(v);
   lpxHv = -N/2*log(2*pi*v) - .5*ldr-.5*xt'*(R\xt);
This can be implemented efficiently using software/pdf_arma_exact.m (See section 9.2.3):
 
    lpxHv = pdf_arma_exact(x/sqrt(v),a,1,e,0)-N/2*log(v);
For additional information and experimental results of this module, see software/module_acfx.m, software/module_acfx_test.m, software/module_acfx_synth.m, and see Section 9.4.10.

Baggenstoss 2017-05-19