main content

wavelet time scattering -凯发k8网页登录

wavelet time scattering

since r2018b

description

use the waveletscattering object to create a network for a wavelet time scattering decomposition using the gabor (analytic morlet) wavelet. the network uses wavelets and a lowpass scaling function to generate low-variance representations of real-valued time series data. wavelet time scattering yields representations insensitive to translations in the input signal without sacrificing class discriminability. you can use the representations as inputs to a classifier. you can specify the duration of translation invariance and the number of wavelet filters per octave. the scattering network also supports time × channel × batch (t×c×b) inputs.

creation

description

example

sf = waveletscattering creates a wavelet time scattering network with two filter banks. the first filter bank has a quality (q) factor of eight wavelets per octave. the second filter bank has a q factor of one wavelet per octave. by default, waveletscattering assumes a signal input length of 1024 samples. the scale invariance length is 512 samples. by default, waveletscattering uses periodic boundary conditions.

example

sf = waveletscattering(name,value) creates a network for wavelet scattering, sf, with properties specified by one or more name,value arguments. properties can be specified in any order as name1,value1,...,namen,valuen. enclose each property name in quotes.

note

after you create a scattering network, you can change the value of the oversamplingfactor property. depending on the precision of the network and the input signal, the value of the precision property can also change. all other network property values remain fixed.

properties

signal length in samples, specified as a positive integer ≥ 16. if the input to the scattering network is a row vector, signallength must match the number of columns in the input data. if the input to the scattering network is a column vector, matrix, or 3-d array, signallength must match the number of rows in the data.

data types: double

sampling frequency in hertz, specified as a positive scalar. if unspecified, frequencies are in cycles/sample and the nyquist frequency is ½.

data types: double

scattering transform invariance scale, specified as a positive scalar. invariancescale specifies the translation invariance of the scattering transform. if you do not specify samplingfrequency, invariancescale is measured in samples. if you specify samplingfrequency, invariancescale is measured in seconds.

invariancescale cannot exceed signallength in samples.

example: sf = waveletscattering('signallength',1000,'samplingfrequency',200,'invariancescale',5) has the largest possible invariance scale.

data types: double

scattering filter bank q factors, specified as a positive integer or a vector of positive integers. a filter bank q factor is the number of wavelet filters per octave. q factors must be less than or equal to 32 and greater than or equal to 1.

if qualityfactors is specified as a vector, the elements of qualityfactors must be strictly decreasing.

example: sf = waveletscattering('qualityfactors',[8 2 1]) creates a wavelet scattering network with three filter banks.

data types: double

signal extension method to apply at the boundary:

  • 'periodic' — extend signal periodically to length 2^ceil(log2(n)), where n is the signal length.

  • 'reflection' — extend signal by reflection to length 2^ceil(log2(2 n)), where n is the signal length.

the signal is extended to match the length of the wavelet filters. the length of the filters are powers of two.

the signal extension method is for internal operations. results are downsampled back onto the scale of the original signal before being returned.

numeric precision of wavelet scattering network:

  • 'double' — double precision

  • 'single' — single precision

if you construct a scattering network with double-precision filters and apply the network to single-precision data, the filters are cast internally to single-precision. subsequent filtering is done with single precision until a new network is created regardless of input data type. for more information, see the example wavelet time scattering network precision.

specifying precision as 'single' at construction is useful if you want to use the object with single-precision data and reduce the memory footprint of the scattering network.

oversampling factor, specified as a nonnegative integer or inf. the factor specifies how much the scattering coefficients are oversampled with respect to the critically downsampled values. the factor is on a log2 scale. by default, oversamplingfactor is set to 0, which corresponds to critically downsampling the coefficients. you can use to determine the number of coefficients obtained for a scattering network. to obtain a fully undecimated scattering transform, set oversamplingfactor to inf.

setting oversamplingfactor to a value that would result in more coefficients than samples is equivalent to setting oversamplingfactor to inf. increasing the oversamplingfactor significantly increases the computational complexity and memory requirements of the scattering transform.

example: if sf = waveletscattering('oversamplingfactor',2), the scattering transform returns 22 times as many coefficients for each scattering path with respect to the critically sampled number.

optimize scattering transform logical which determines whether the scattering transform reduces the number of scattering paths to compute based on a bandwidth consideration, specified as a numeric or logical 1 (true) or 0 (false).

if you specify optimizepath as true, the scattering transform excludes scattering paths of order 2 and greater which do not satisfy the following criterion: the center frequency minus ½ the 3-db bandwidth of the wavelet filter in the (i 1)th filter bank must overlap 0 (dc) plus ½ the 3-db bandwidth of the wavelet filter in the ith filter bank. if this criterion is not satisfied, the higher-order path is excluded. setting optimizepath to true can significantly reduce the number of scattering paths and computational complexity of the scattering transform for most networks.

you can use the object function to determine which and how many scattering paths are computed.

object functions

wavelet 1-d scattering transform
scattering feature matrix
natural logarithm of scattering transform
wavelet time scattering filter banks
littlewood-paley sum
visualize scattering or scalogram coefficients
wavelet scattering bandpass center frequencies
number of scattering orders
number of scattering filter banks
number of wavelet scattering coefficients
scattering network paths
collect scattering network properties into local workspace

examples

create a wavelet time scattering network with default values.

sf = waveletscattering
sf = 
  waveletscattering with properties:
          signallength: 1024
       invariancescale: 512
        qualityfactors: [8 1]
              boundary: 'periodic'
     samplingfrequency: 1
             precision: 'double'
    oversamplingfactor: 0
          optimizepath: 0

plot the wavelet filters used in the first and second filter banks.

[filters,f] = filterbank(sf);
plot(f,filters{2}.psift)
title('first filter bank')
xlabel('cycles/sample')
ylabel('magnitude')
grid on

figure contains an axes object. the axes object with title first filter bank, xlabel cycles/sample, ylabel magnitude contains 41 objects of type line.

figure
plot(f,filters{3}.psift)
title('second filter bank')
xlabel('cycles/sample')
ylabel('magnitude')
grid on

figure contains an axes object. the axes object with title second filter bank, xlabel cycles/sample, ylabel magnitude contains 7 objects of type line.

plot the littlewood-paley sums of the filter banks.

[lpsum,f] = littlewoodpaleysum(sf);
figure
plot(f,lpsum)
legend('1st filter bank','2nd filter bank')
xlabel('cycles/sample')
grid on

figure contains an axes object. the axes object with xlabel cycles/sample contains 2 objects of type line. these objects represent 1st filter bank, 2nd filter bank.

this example shows how to create and apply a wavelet time scattering network with three filter banks to data.

load in a data set. create a scattering network with three filter banks that can be applied to the data.

load handel
disp(['data sampling frequency: ',num2str(fs),' hz'])
data sampling frequency: 8192 hz
sf = waveletscattering('signallength',numel(y),...
    'samplingfrequency',fs,...
    'qualityfactors',[4 2 1])
sf = 
  waveletscattering with properties:
          signallength: 73113
       invariancescale: 4.4625
        qualityfactors: [4 2 1]
              boundary: 'periodic'
     samplingfrequency: 8192
             precision: 'double'
    oversamplingfactor: 0
          optimizepath: 0

inspect the network. plot the wavelet filters used in the third filter bank.

[filters,f] = filterbank(sf);
plot(f,filters{4}.psift)
title('third filter bank')
xlabel('hertz')
ylabel('magnitude')
grid on

plot the littlewood-paley sums of the three filter banks.

[lpsum,f] = littlewoodpaleysum(sf);
figure
plot(f,lpsum)
xlabel('hertz')
grid on
legend('1st filter bank','2nd filter bank','3rd filter bank')

calculate the wavelet 1-d scattering transform of the data for sf. visualize the scattergram of the scalogram coefficients for the first filter bank.

[s,u] = scatteringtransform(sf,y);
figure
scattergram(sf,u,'filterbank',1)

this example shows how single-precision input changes the default numeric precision of a wavelet scattering network.

create a wavelet time scattering network with default values. the precision of the network is double.

sf = waveletscattering
sf = 
  waveletscattering with properties:
          signallength: 1024
       invariancescale: 512
        qualityfactors: [8 1]
              boundary: 'periodic'
     samplingfrequency: 1
             precision: 'double'
    oversamplingfactor: 0
          optimizepath: 0

use the object function to obtain the scattering filter banks. the filterbank function returns the filter banks in a cell array. confirm the filters are double precision.

sffilters = filterbank(sf);
prectype = "double";
fprintf("checking precision: %s\n",prectype)
checking precision: double
fprintf("sffilters{1}.phift: %d\n",isa(sffilters{1}.phift,prectype))
sffilters{1}.phift: 1
for k=2:numel(sffilters)
    fprintf("sffilters{%d}.phift: %d\n",k,isa(sffilters{k}.phift,prectype))
    fprintf("sffilters{%d}.psift: %d\n",k,isa(sffilters{k}.psift,prectype))
end
sffilters{2}.phift: 1
sffilters{2}.psift: 1
sffilters{3}.phift: 1
sffilters{3}.psift: 1

load the noisy doppler signal. the signal is double precision.

load noisdopp
isa(noisdopp,"double")
ans = logical
   1

use the object function to obtain the scattering coefficient matrix for the scattering network and the signal. confirm the precision of the matrix is double.

smat = featurematrix(sf,noisdopp);
isa(smat,"double")
ans = logical
   1

convert the signal to single precision. obtain the scattering coefficient matrix of the single-precision signal using the scattering network. confirm the matrix precision is single.

noisdoppsingle = single(noisdopp);
smatsingle = featurematrix(sf,noisdoppsingle);
isa(smatsingle,"single")
ans = logical
   1

confirm that by using single-precision input, the numeric precision of the scattering network has changed to single.

sf
sf = 
  waveletscattering with properties:
          signallength: 1024
       invariancescale: 512
        qualityfactors: [8 1]
              boundary: 'periodic'
     samplingfrequency: 1
             precision: 'single'
    oversamplingfactor: 0
          optimizepath: 0

use the featurematrix function to obtain the scattering coefficient matrix for the scattering network and the double-precision signal. because the numeric precision of the network is now single, the matrix precision is single.

smatsingle2 = featurematrix(sf,noisdopp);
isa(smatsingle2,"single")
ans = logical
   1

use the filterbank function to obtain the filter banks. confirm the filters have changed to single precision.

sffilterssingle = filterbank(sf);
prectype = "single";
fprintf("checking precision: %s\n",prectype)
checking precision: single
fprintf("sffilterssingle{1}.phift: %d\n",isa(sffilterssingle{1}.phift,prectype))
sffilterssingle{1}.phift: 1
for k=2:numel(sffilters)
    fprintf("sffilterssingle{%d}.phift: %d\n",k,isa(sffilterssingle{k}.phift,prectype))
    fprintf("sffilterssingle{%d}.psift: %d\n",k,isa(sffilterssingle{k}.psift,prectype))
end
sffilterssingle{2}.phift: 1
sffilterssingle{2}.psift: 1
sffilterssingle{3}.phift: 1
sffilterssingle{3}.psift: 1

more about

references

[1] andén, joakim, and stéphane mallat. “deep scattering spectrum.” ieee transactions on signal processing 62, no. 16 (august 2014): 4114–28. https://doi.org/10.1109/tsp.2014.2326991.

[2] mallat, stéphane. “group invariant scattering.” communications on pure and applied mathematics 65, no. 10 (october 2012): 1331–98. https://doi.org/10.1002/cpa.21413.

extended capabilities

version history

introduced in r2018b

see also

functions

objects

  • |

blocks

  • (dsp system toolbox)
网站地图