General Usage

We provide detailed documentation of WidebandDoA and ReversibleJump here. A comprehensive example usage of these functionalities can be found in the demo

Sampling

This package uses ReversibleJump for drawing samples. To draw samples, the user needs to call the following function

ReversibleJump.sample([rng,] sampler, model, N, initial_order; initial_params, show_progress)

Arguments

  • sampler: An RJMCMC sampler provided by ReversibleJump.
  • model: A model provided by WidebandDoA conditioned on data.
  • N::Int: The number of samples.
  • initial_order::Int: The model order of initial_params.

Keyword Arguments

  • show_progress::Bool: Whether to enable ProgresMeter
  • initial_params: The initial state of the Markov chain. The order of this parameter must match initial_order for correct results.

For more details about the available options for sampler, refer to here.

Bayesian Model

The Bayesian model described in the paper can be constructed through the following constructor:

WidebandDoA.WidebandIsoIsoModelType
WidebandIsoIsoModel(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)
source

IsoIso in the name indicates that we are using an isotrpoic normal prior on both the source signals and the noise.

This model can be conditioned on data by invoking the following constructor:

WidebandDoA.WidebandConditionedType
WidebandConditioned(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.
source

The overall process is as follows. Given a received signal y:

model = WidebandDoA.WidebandIsoIsoModel(
    N, Δx, c, fs, source_prior, alpha, beta; order_prior
)
cond  = WidebandConditioned(model, y)

This can then be used with ReversibleJump.sample.

Simulating Data

Given a model, prior and likelihood simulations can be done through the following specialization of Base.rand:

Base.randFunction
rand(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.
source
rand(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 from prior.model_order.)
  • sigma: Signal standard deviation. (Default samples from InverseGamma(prior.alpha, prior.beta).)
  • phi: DoA of each sources. (Length must match k; default samples from the uniform distribution over the interval $[-\pi/2 , \pi/2]$.)
  • lambda: SNR parameter for each source. (Length must match k; default samples from prior.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)
source
rand(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 sample sigma if needed (default: nothing).
  • sigma: Signal standard deviation. (Default samples from InverseGamma(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.

source

Reconstruction

Given a conditioned model, reconstruction of the latent signals conditional on a set of parameters can be done through the following function:

WidebandDoA.reconstructFunction
reconstruct(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.
source

Relabling

As explained in the paper, to analyze the individual sources, the RJMCMC samplers need to be relabeled. The labels and the Gaussian mixture approximation on the DoAs can be generated through the following function:

WidebandDoA.relabelFunction
relabel(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 over samples.
  • 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.

source
  • 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).