WidebandDoA.IndependentMetropolis
WidebandDoA.MetropolisMixture
WidebandDoA.RandomWalkMetropolis
WidebandDoA.Slice
WidebandDoA.SliceDoublingOut
WidebandDoA.SliceSteppingOut
WidebandDoA.UniformNormalLocalProposal
WidebandDoA.WidebandConditioned
WidebandDoA.WidebandData
WidebandDoA.WidebandIsoIsoLikelihood
WidebandDoA.WidebandIsoIsoMetropolis
WidebandDoA.WidebandIsoIsoModel
WidebandDoA.WidebandIsoIsoParam
WidebandDoA.WidebandIsoSourcePrior
WidebandDoA.WindowedSinc
Base.rand
Base.rand
Base.rand
WidebandDoA.array_delay
WidebandDoA.inter_sensor_delay
WidebandDoA.loglikelihood
WidebandDoA.logpriordensity
WidebandDoA.reconstruct
WidebandDoA.relabel
WidebandDoA.IndependentMetropolis
— TypeIndependentMetropolis(proposal) <: AbstractMetropolis
Independent Metropolis Hastings sampler. (Also known as the independence sampler.)
Arguments
proposal::UnivariateDistribution
: Univariate distribution.
WidebandDoA.MetropolisMixture
— TypeMetropolisMixture(imh, rwmh; imh_weight) <: AbstractMetropolis
Mixture kernel of an IMH kernel and RWMH kernel, as originally used by Andrieu and Doucet[AD1999].
Arguments
imh::IndependentMetropolis
: IMH kernel.rwmh::RandomWalkMetropolis
: RWMH kernel.imh_weight::Real
: Mixture weight of selecting the IMH kernel. RWMH kernel is proposed with probability1 - imh_weight
(default: 0.2)
WidebandDoA.RandomWalkMetropolis
— TypeRandomWalkMetropolis(sigma) <: AbstractMetropolis
Isotropic Gaussian random walk proposal.
Arguments
sigma::Real
: Standard deviation of the Gaussian proposal.
WidebandDoA.Slice
— TypeSlice(window)
Slice sampler with fixed search interval.
Arguments
window::AbstractVector
: Initial search interval window.
WidebandDoA.SliceDoublingOut
— TypeSliceDoublingOut(max_doubling_out, window)
SliceDoublingOut(window)
Slice sampler with the doubling-out procedure.
Arguments
max_stepping_out::Int
: Maximum number of doubling outs. (default: 8)window::AbstractVector
: Initial search interval window.
WidebandDoA.SliceSteppingOut
— TypeSliceSteppingOut(max_stepping_out, window)
SliceSteppingOut(window)
Slice sampler with the stepping-out procedure.
Arguments
max_stepping_out::Int
: Maximum number of stepping outs. (default: 32)window::AbstractVector
: Initial search interval window.
WidebandDoA.UniformNormalLocalProposal
— TypeUniformNormalLocalProposal(mu, sigma)
Uniform proposal over the DoAs and a log-normal propsal over the SNR parameters of a source.
Arguments
mu
: Mean of the log-normal proposal on the SNR parameter.sigma
: Standard deviation of the log-normal proposal on the SNR parameter.
This corresponds to the following proposal:
\[\begin{aligned} \phi_j &\sim q\left(\phi\right) = \mathsf{Uniform}\left(-\frac{\pi}{2}, \frac{\pi}{2}\right) \\ \gamma_j &\sim q\left(\gamma\right) = \text{\sf{}Log-Normal}\left(\text{\tt{}mu}, \text{\tt{}sigma}\right) \end{aligned}\]
WidebandDoA.WidebandConditioned
— TypeWidebandConditioned(model, y)
model
conditioned on y
.
Arguments
model::AbstractWidebandModel
: Signal model.y::AbstractMatrix
: Received data, where the rows are the channels (sersors), while the columns are the signals.
WidebandDoA.WidebandData
— TypeWidebandData(y, y_fft, y_power)
Received signal with pre-processing.
Arguments
y
: Received signal, where the rows are the channels (sersors), while the columns are the signals.y_fft
: Received signal after applying a channel-wise FFT.y_power
: Power of the received signal.
WidebandDoA.WidebandIsoIsoLikelihood
— TypeWidebandIsoIsoLikelihood(n_samples, n_fft, delay_filter, Δx, c, fs)
Collapsed likelihood for a isotropic normal source prior and an isotropic normal noise prior.
Arguments
n_samples::Int
: Number of samples in received signal.n_fft::Int
: Length of the latent source signal.delay_filter::AbstractDelayFilter
: Delay filter.Δx::AbstractVector
: Inter-sensor delay in seconds.c::Real
: Propagation speed of the medium in m/s.fs::Real
: Sampling rate in Hz.
Given a parameter NamedTuple(phi[j], loglambda[j])
, this likelihood computes:
\[\begin{aligned} &\log p\left(y \mid \phi_{1:k}, \gamma_{1:k}, \alpha, \beta \right) \\ &= -\frac{N + \beta}{2} \log\left(\frac{\alpha}{2} + y^{\dagger} {(H \Lambda H^{\dagger} + \mathrm{I})}^{-1} y \right) - \frac{1}{2} \det \left(H^{\dagger} \Lambda H + \mathrm{I}\right) \\ &= -\frac{N + \beta}{2} \log\left(\frac{\alpha}{2} + y^{\dagger} y - y^{\dagger} H {\left( \Lambda^{-1} + H^{\dagger} H \right)}^{-1} H^{\dagger} y \right) - \frac{1}{2} \det\left(\Lambda\right) \det \left(\Lambda^{-1} + H^{\dagger} H \right), \\ \end{aligned}\]
where
\[\Lambda = \mathrm{diag}\left( \exp\left( \text{\textsf{loglambda[0]}} \right), \ldots, \exp\left( \text{\textsf{loglambda[k]}} \right) \right)\]
(Note that $\gamma_j$ in the paper is lambda[j]
in the code, which is a bit confusing.)
WidebandDoA.WidebandIsoIsoMetropolis
— TypeWidebandIsoIsoMetropolis(phi_kernel, loglambda_kernel)
Wrapper for Metropolis-Hastings (MH) kernels applied to WidebandIsoIsoModel
.
Arguments
phi_kernel::AbstractMetropolis
: MH kernel for the direction-of-arrival parameter $\phi$.loglambda_kernel::AbstractMetropolis
: MH kernel for the SNR parameter $\log\lambda$.
WidebandDoA.WidebandIsoIsoModel
— TypeWidebandIsoIsoModel(n_samples, Δx, c, fs, source_prior, α, β, order_prior, n_fft)
Model for wideband signal model with isotropic normal source prior and isotropic normal noise prior.
Arguments
n_samples::Int
: Number of samples of the received signal.Δx::AbstractVector
: Relative sensor location [m].c::Real
: Propagation speed of the medium [m/s].fs::Real
: Sampling frequency [Hz].source_prior::UnivariateDistribution
: Prior on the SNR parameter ($\gamma_j$ in the paper) of the sources.α::Real
: $\alpha$ hyperparameter of the inerse-gamma prior on the signal standard deviation ($\sigma$ in the paper; default: 0)β::Real
$\beta$ hyperparameter of the inerse-gamma prior on the signal standard deviation ($\sigma$ in the paper; default: 0)order_prior::DiscreteDistribution
: Prior on the model order ($k$ in the paper; default:NegativeBinomial(1/2 + 0.1, 0.1/(0.1 + 1))
)n_fft::Int
: Length of the source signals. (default:n_samples*2
)
WidebandDoA.WidebandIsoIsoParam
— TypeWidebandIsoIsoParam(phi, loglambda)
Local parameter of WidebandIsoIsoModel
.
WidebandDoA.WidebandIsoSourcePrior
— TypeWidebandIsoSourcePrior(n_samples, n_fft, alpha, beta, order_prior, source_prior)
Prior for wideband signal model, where a Gaussian prior with an isotropic covariance structure is assigned on the latent source signals.
Arguments
samples::Int
: Number of samples in the received signal.n_fft::Int
: Length of the latent signal ($N^{\prime}$ in the paper).alpha::Real
: $\alpha$ hyperparameter for the inverse-gamma prior on the signal variance.beta::Real
: $\beta$ hyperparameter for the inverse-gamma prior on the signal variance.order_prior::DiscreteDistribution
: Prior on the number of sources. (Prior on $k$ in the paper.)source_prior::UnivariateDistribution
: Hyperprior on the SNR hyperparameter of the sources. (Prior on $\gamma$ in the paper.)
WidebandDoA.WindowedSinc
— TypeWindowedSinc(n_fft) <: AbstractDelayFilter
Closed-form fractional delay filter by Pei and Lai[PL2012][PL2014]
Arguments
n_fft::Int
: Number of taps of the filter.
Base.rand
— Methodrand(rng, model)
Sample from a wideband signal model.
Arguments
rng::Random.AbstractRNG
model
: Wideband signal model.
Returns
params
:NamedTuple
containing the model parameters.data
: Simulated received data.
Base.rand
— Methodrand(rng, likelihood::WidebandIsoIsoLikelihood, x, phi; prior, sigma)
Sample from the collapsed likelihood for the model with isotropic normal prior and isotropic normal noise.
Arguments
rng::Random.AbstractRNG
: Random number generator.likelihood::WidebandIsoIsoLikelihood
: Likelihood.x::AbstractMatrix
: Latent source signals, where rows are the signals and columns are sources.phi::AbstractVector
: Direction-of-arrivals.
Keyword Arguments
prior
: Prior object used to samplesigma
if needed (default:nothing
).sigma
: Signal standard deviation. (Default samples fromInverseGamma(prior.alpha, prior.beta)
)
Returns
y
: A simulated received signal, where the rows are the channels (sensors) and the columns are received signals.
The sampling process is as follows:
\[\begin{aligned} \epsilon &\sim \mathcal{N}(0, \sigma^2 \mathrm{I}) \\ x &\sim \mathcal{N}(0, \sigma^2 H \Lambda H^{\top}) \\ y &= x + \epsilon \end{aligned}\]
and the noise $\epsilon$,
\[\begin{aligned} y &\sim \mathcal{N}(0, \sigma^2 \left( H \Lambda H^{\top} + \mathrm{I} \right)). \end{aligned}\]
Sampling from this distribution is as simple as
\[\begin{aligned} y = \sigma H \Lambda^{1/2} z_x + \sigma z_{\epsilon}, \end{aligned}\]
where $z_x$ and $z_{\epsilon}$ are independent standard Gaussian vectors.
Base.rand
— Methodrand(rng, prior::WidebandIsoSourcePrior, )
Sample from prior with isotropic source covariance prior.
Arguments
rng::Random.AbstractRNG
: Random number generator.prior::WidebandIsoSourcePrior
: Prior.
Keyword Arguments
k
: Model order. (Default samples fromprior.model_order
.)sigma
: Signal standard deviation. (Default samples fromInverseGamma(prior.alpha, prior.beta)
.)phi
: DoA of each sources. (Length must matchk
; default samples from the uniform distribution over the interval $[-\pi/2 , \pi/2]$.)lambda
: SNR parameter for each source. (Length must matchk
; default samples fromprior.source_prior
.)
The sampling process is:
\[\begin{aligned} k &\sim \text{\tt{}prior.model\_order} \\ \sigma &\sim \text{\textsf{Inv-Gamma}}(\texttt{prior.alpha}, \text{\texttt{prior.beta}}) \\ \phi_j \mid k &\sim \text{\textsf{Uniform}}\left(-\frac{\pi}{2}, \frac{\pi}{2}\right) \\ \lambda_j \mid k &\sim \text{\tt{}prior.source\_prior} \\ x_j \mid k, \sigma, \lambda_j &\sim \mathcal{N}\left(0, \sigma \lambda_j \mathrm{I} \right) \end{aligned}\]
Returns
params
: Parameter of wideband signal model. (keys:k, phi, lambda, sigma, x
)
WidebandDoA.array_delay
— Functionarray_delay(filter, Δn)
Returns the fourier domain fractional delay filters as a matrix $H \in \mathbb{R}^{ N \times M \times K }$. The fractional delay filters are the ones in:
WidebandDoA.inter_sensor_delay
— Methodinter_sensor_delay(ϕ, Δx, c)
Compute the inter-sensor delay matrix $D \in \mathbb{R}^{M \times K}$ in seconds for a linear array, where M = length(isd)
is the number of sensors on the array, and K = length(isd)
is the number of targets. The matrix is computed as follows:
\[{[D]}_{m,k} = \frac{\Delta x[m] \, \sin(\phi[k])}{c}\]
Arguments
ϕ::AbstractVector
: Vector of DoAs in radian.Δx::AbstractVector
: Vector of inter-sensor delay of the array.c
: Propagation speed of the medium.
Returns
delays
: Matrix containing the delays in seconds. Each row correspond to sensor, and each column correspond to the source.
WidebandDoA.loglikelihood
— Functionloglikelihood(likelihood, params)
Log likelihood of likelihood
evaluated on params
.
WidebandDoA.logpriordensity
— Functionlogpriordensity(prior, params)
Log density of prior
evaluated on params
.
WidebandDoA.reconstruct
— Methodreconstruct(cond::WidebandConditioned, params)
Conditional posterior of the latent source signals for reconstruction given conditioned model cond
and params
Arguments
cond::WidebandConditioned
: Conditioned model.params
: Additional parameters we need to condition on.
Returns
cond_post
: Conditional posterior for the latent source signals.
WidebandDoA.relabel
— Methodrelabel(rng, samples, n_mixture; n_iter, n_imh_iter, show_progress)
Relabel the RJMCMC samples samples
into n_mixture
Gaussian mixtures according to the stochastic expectation maximization (SEM) procedure of Roodaki et al. 2014[RBF2014].
Arguments
rng::Random.AbstractRNG
samples::AbstractVector{<:AbstractVector{<:Real}}
: Samples subject to relabeling.n_mixture::Int
: Number of component in the Gaussian mixture. Roodaki et al. recommend setting this as the 80% or 90% percentile of model order posterior.
Keyword Arguments
n_iter::Int
: Number of SEM iterations (default:16
).n_mh_iter::Int
: Number of Metropolis-Hastings steps for sampling an a label assignment (default:32
).show_progress::Bool
: Whether to enable progresss line (default:true
).
Returns
mixture::Distributions.MixtureModel
: The Gaussian mixture model fit oversamples
.labels::Vector{Vector{Int}}
: Labels assigned to each element of each RJCMCM sample.
The length of each RJCMCMC sample in samples
is the model order of that specific sample. Each element of an RJCMCM sample should be the variables that determine which label this element should be associated with.
- AD1999Andrieu, Christophe, and Arnaud Doucet. "Joint Bayesian model selection and estimation of noisy sinusoids via reversible jump MCMC." IEEE Transactions on Signal Processing 47.10 (1999): 2667-2676.
- PL2012S. -C. Pei and Y. -C. Lai, "Closed Form Variable Fractional Time Delay Using FFT," IEEE Signal Processing Letters, 2012.
- PL2014S. -C. Pei and Y. -C. Lai, "Closed form variable fractional delay using FFT with transition band trade-off," In Proceedings of the IEEE International Symposium on Circuits and Systems (ISCAS), 2014.
- RBF2014Roodaki, Alireza, Julien Bect, and Gilles Fleury. "Relabeling and summarizing posterior distributions in signal decomposition problems when the number of components is unknown." IEEE Transactions on Signal Processing (2014).