Defining and Computing Features

Features can be defined using a convenient cell array structure that contains a series of MATLAB commands to execute. For example, the calculation of AR features according to Section 9.4.10 is given by:
    % define AR model order, proportional to segment size:
    Ps    =   ceil(Ns/max(Ns)*PMAX);

    % define feature module function calls and inversion calls -
    % each set of calls must assume input data is in 'x' and
    % outpus are 'z' and 'jout'
    for i=1:nfeat,
        func_str{i}{1}='E0=1; % indicate that we use sig2, not r0';
        func_str{i}{2}=['P=' num2str(Ps(i)) ';'];

        inv_str{i}{1}='E0=1; % indicate that we use sig2, not r0';
        inv_str{i}{2}=['N=' num2str(Ns(i)) ';'];
Notice that both the feature chain and inversion chain are defined. Once the chains are defined, you can use the function software/mrhmm_compute_features.mto compute the features. Let X be a cell array, with a time-series (called an event) in each entry. Then, the call
produces the cell array output Z such that Z{isamp}{ifeat} is a dim-by-n array of output features, where isamp is the index of the time-series event, ifeat is the feature index (first index into func_str), and dim is the feature dimension (P+1 for AR features). Each of the n columns of the output array is the feature vector for a different time shift in increments of shfts(ifeat) samples. The J-function output J{isamp}{ifeat} is similarly defined, but is of dimension 1-by-n. The variable max_segment_size is also provided as a check to insure that all data events are of a length divisible by max_segment_size.

Baggenstoss 2017-05-19