scatteringTransform type
ScatteringTransform.scatteringTransform — TypescatteringTransform{Dimension,Depth}The abstract type and constructor for scattering transforms. The specific types are stFlux in this package, and stParallel in ParallelScattering.jl.
ScatteringTransform.scatteringTransform — MethodscatteringTransform(inputSize, m=2, backend::UnionAll=stFlux; kwargs...)The constructor for the abstract type scatteringTransform, with the concrete type specified by backend.
ScatteringTransform.stFlux — TypestFlux(inputSize::NTuple{N}, m=2; trainable=false,
normalize=true, outputPool=2,
poolBy=3 // 2, σ=abs, flatten=false, kwargs...)Create a scattering transform of depth m (which returns a m+1 depth list of arrays stored in a ScatteredOut) that subsamples at a rate of poolBy each layer, using scales[i] and shearLevels[i] at each layer. normalize means give each layer the same average weight per path, e.g. since the zeroth layer has one path, give it norm 1, if the first layer has 16 paths, give the sum across all first layer paths norm 16, etc. This is primarily for cases where the classification algorithm needs roughly the same order of magnitude variance. flatten means return a result that is a matrix of size (:,nExamples) where nExamples is the last dimension of inputSize. σ is the nonlinearity used. Any additional keyword args kwargs... come from either the FourierFilterFlux waveletLayerConstructor, or subsequently from ContinuousWavlets wavelet constructor ContinuousWavelets.
Examples
julia> using ScatteringTransform
julia> x = [ones(128); zeros(128)];
julia> St = stFlux((256,1,1))
┌ Warning: there are wavelets whose peaks are far enough apart that the trough between them is less than half the height of the highest frequency wavelet
│ minimalRegionComparedToLastPeak = 2.45709167339886
└ @ ContinuousWavelets ~/allHail/projects/ContinuousWavelets/src/sanityChecks.jl:28
┌ Warning: there are wavelets whose peaks are far enough apart that the trough between them is less than half the height of the highest frequency wavelet
│ minimalRegionComparedToLastPeak = 2.5356674293941244
└ @ ContinuousWavelets ~/allHail/projects/ContinuousWavelets/src/sanityChecks.jl:28
┌ Warning: there are wavelets whose peaks are far enough apart that the trough between them is less than half the height of the highest frequency wavelet
│ minimalRegionComparedToLastPeak = 2.2954419414285616
└ @ ContinuousWavelets ~/allHail/projects/ContinuousWavelets/src/sanityChecks.jl:28
stFlux{2, Nd=1, filters=[12], σ = abs, batchSize = 1, normalize = true}
julia> St(x)
ScatteredOut{Array{Float32},3} 1 dim. OutputSizes:
(128, 1, 1)
(86, 12, 1)
(57, 11, 12, 1)
Parameters unique to ScatteringTransform.jl
m::Integer=2: the total number of layersnormalize::Bool=true: if true, apply the functionnormalize. The amount of energy in each layer decays exponentially for most inputs, so without normalizing, using the scattering coefficients poses some difficulty. To avoid this, whennormalizeis true, each layer is divided by the overall norm of that layer, and then multiplied by the number of paths in that layer.poolBy::Union{<:Integer, <:Rational, <:Tuple}=3//2: the amount to pool between layers. For a two layer network, the default is expanded to(3//2, 3//2, 3//2), corresponding to the first layer, second layer, and final averaging subsampling rates. It also accepts tuples that are too short, and simply replicates the last entry, e.g.poolBy=(2,3//2)for a three layer network is equivalent topoolBy=(2,3//2,3//2,3//2).outputPool::Union{<:Integer, <:Rational, <:Tuple}=2: the amount to subsample after averaging in each layer (present because averaging removes the high frequencies, so the full signal is inherently redundant). Has a similar structure topoolBy.flatten::Bool=false: if true, return a matrix that is(nCoefficients,nExamples), otherwise, return the more structuredScatteredOutσ::function=abs: the nonlinearity applied pointwise between layers. This should take in aNumber, and return aNumber(real or complex floating point). If the wavelet transform is analytic, this must have a method forComplex.
Parameters passed to FourierFilterFlux.jl
dtype::DataType=Float32: the data type used to represent the filters.cw::ContWaveClass=Morlet(): the type of wavelet to use.plan::Bool=true: if true, store the fft plan for reuse.convBoundary::ConvBoundary=Sym(): the type of symmetry to use in computing the transform. Note thatconvBoundaryandboundaryare different, withboundaryneeding to be set using types from ContinuousWavelets andconvBoundaryneeds to be set using the FourierFilterFlux types.averagingLayer::Bool=false: if true, use just the averaging filter, and drop all other filters.trainable::Bool=false: if true, the wavelet filters are considered parameters, and can be updated using standard methods from Flux.jl.bias::Bool=false: if true, include an offset, initialized usinginit. Most likely to be used withtrainabletrue.init::function=Flux.glorot_normal: a function to initialize the bias, otherwise ignored.
Parameters passed to ContinuousWavelets.jl
scalingFactor,s, orQ::Real=8.0: the number of wavelets between the octaves $2^J$ and $2^{J+1}$ (defaults to 8, which is most appropriate for music and other audio). Valid range is $(0,\infty)$.β::Real=4.0: As using exactlyQwavelets per octave leads to excessively many low-frequency wavelets,βvaries the number of wavelets per octave, with larger values ofβcorresponding to fewer low frequency wavelets(see Wavelet Frequency Spacing for details). Valid range is $(1,\infty)$, though aroundβ=6the spacing is approximately linear in frequency, rather than log-frequency, and begins to become concave after that.boundary::WaveletBoundary=SymBoundary(): The default boundary condition isSymBoundary(), implemented by appending a flipped version of the vector at the end to eliminate edge discontinuities. See Boundary Conditions for the other possibilities.averagingType::Average=Father(): determines whether or not to include the averaging function, and if so, what kind of averaging. The options areFather: use the averaging function that corresponds to the mother Wavelet.Dirac: use the sinc function with the appropriate width.NoAve: don't average. this has one fewer filters than the otheraveragingTypes
averagingLength::Int=4: the number of wavelet octaves that are covered by the averaging,frameBound::Real=1: gives the total norm of the whole collection, corresponding to the upper frame bound; if you don't want to impose a particular bound, setframeBound<0.normalizationorp::Real=Inf: the p-norm preserved as the scale changes, so if we're scaling by $s$,normalizationhas valuep, and the mother wavelet is $\psi$, then the resulting wavelet is $s^{1/p}\psi(^{t}/_{s})$. The default scaling,Infgives all the same maximum value in the frequency domain. Valid range is $(0,\infty]$, though $p<1$ isn't actually preserving a norm.