ICA_BlindSourceSeparation

Documentation for ICA_BlindSourceSeparation.

ICA_BlindSourceSeparation.gradientMethod
gradient(Y, psiY)

Compute the gradient of the contrast function with respect to the input signals.

Arguments

  • Y::AbstractMatrix{<:Real}: an N×T matrix where each row is a signal component over T samples.
  • psiY::AbstractMatrix{<:Real}: the elementwise derivative of the contrast function, same size as Y.

Returns

  • An N×N matrix representing the relative gradient
source
ICA_BlindSourceSeparation.ica_picardMethod
ica_picard(dataset::sensorData, m::Int, maxiter::Int, tol::Real, lambda_min::Real, ls_tries::Int; verbose::Bool=false)

Perform Independent Component Analysis (ICA) using the Picard algorithm with limited-memory BFGS optimization.

Arguments

  • dataset::sensorData
  • m::Int: Size of L-BFGS's memory. Typical values are in the range 3-15
  • maxiter::Int: Maximal number of iterations
  • tol::real: tolerance for the stopping criterion. Iterations stop when the norm of the projected gradient gets smaller than tol.
  • lambda_min::Real: Minimum eigenvalue for regularizing the Hessian approximation.
  • ls_tries::Int: Number of tries allowed for the backtracking line-search. When that number is exceeded, the direction is thrown away and the gradient is used instead.
  • verbose::Bool=false: If true, prints the informations about the algorithm.

Returns

  • sensorData: A new sensorData object containing the unmixed data.
source
ICA_BlindSourceSeparation.ica_shibbsMethod
ica_shibbs(dataset::sensorData, m::Integer, maxSteps::Integer)

Outer loop of the shibbs algorithm. Whitens data and loops untile diagonalization result is within threshold. Returns the dataset combined with transformation matrix as well as the transformation Matrix

source
ICA_BlindSourceSeparation.l_bfgs_directionMethod
l_bfgs_direction(G, h, s_list, y_list, r_list)

Compute a search direction using the limited-memory BFGS (L-BFGS) algorithm.

Arguments

  • `G::AbstractMatrix{<:Real}: the current gradient.
  • h::AbstractMatrix{<:Real}: a diagonal approximation to the Hessian.
  • s_list::Vector{AbstractMatrix{<:Real}}: list of previous update vectors.
  • y_list::Vector{AbstractMatrix{<:Real}}: list of previous gradient differences.
  • r_list::Vector{Float64}: list of scalars for each pair (s, y).

Returns

  • the descent direction computed using the L-BFGS two-loop recursion.
source
ICA_BlindSourceSeparation.line_searchMethod
function line_search(Y, direction, signs, current_loss; ls_tries)

Perform a backtracking line search using a matrix exponential update.

Arguments

  • Y::AbstractMatrix{<:Real}: current signal matrix (N×T).
  • direction::AbstractMatrix{<:Real}: descent direction matrix of the same size as Y.
  • signs::AbstractVector{<:Real}: sign weights for the loss, same size as Y.
  • current_loss::Real: current loss value, or Inf to force recomputation.
  • ls_tries::Integer (keyword): maximum number of backtracking steps.

Returns

  • A tuple (converged, Y_new, new_loss, alpha) where
  • converged::Bool indicates whether a successful step was found,
  • Y_new::AbstractMatrix{<:Real} is the updated signal matrix (or original if no step succeeded),
  • new_loss::Real is the loss at Y_new,
  • alpha::Real is the final step size.
source
ICA_BlindSourceSeparation.lossMethod
loss(Y, signs)

Compute the total loss for a set of signals.

Arguments

  • Y::AbstractMatrix{<:Real}: matrix of shape N×T, where each row is a signal component over T samples.
  • signs::AbstractMatrix{<:Real}: matrix of the same shape as Y, containing signs or weights for each signal value.

Returns

  • A scalar representing the average contrast-based loss across all components and time steps.
source
ICA_BlindSourceSeparation.proj_hessian_approxMethod
proj_hessian_approx(Y, psidY_mean, G)

Compute an approximation of the projected Hessian matrix.

Arguments

  • Y::AbstractMatrix{<:Real}: an N×T matrix of current signal components.
  • psidY_mean::AbstractVector{<:Real}: a length-N vector containing the average of the second derivative (or negative squared derivative) of the contrast function for each component.
  • G::AbstractMatrix{<:Real}: the gradient matrix of size N×N.

Returns

  • An N×N symmetric matrix approximating the projected Hessian.
source
ICA_BlindSourceSeparation.read_datasetMethod
read_dataset(filename::String) -> sensorData

Reads a file containing numbers separated by spaces or tabs. Number of columns is detected by analyzing the first valid line. Returns an instance of sensorData.

source
ICA_BlindSourceSeparation.regularize_hessianMethod
regularize_hessian(h, lambda_min)

Clip the diagonal values of the Hessian approximation from below, ensuring all values are at least lambda_min.

Arguments

  • h::AbstractMatrix{<:Real}: a diagonal matrix, where diagonal elements approximate eigenvalues.
  • lambda_min::Real: minimum allowed eigenvalue

Returns

  • A matrix of the same size as h, with all values less than lambda_min replaced by lambda_min
source
ICA_BlindSourceSeparation.scoreMethod
score(Y::AbstractArray{<:Real})

Apply the hyperbolic tangent elementwise to each entry of Y.

Arguments

  • Y::AbstractArray{<:Real}: input array (vector, matrix, or higher‑dimensional array) of real numbers.

Returns

  • an array with the same shape as Y, where each element is tanh(y).
source
ICA_BlindSourceSeparation.score_derMethod
score_der(psiY::AbstractMatrix{<:Real})

Computes the average derivative of the hyperbolic tangent nonlinearity for each row of psiY.

Arguments

  • psiY::AbstractMatrix{<:Real}: input array of size N×T, where each row is a signal component over T observations.

Returns

  • a vebtor in which each entry represents the average derivative of the tanh nonlinearity, evaluated at each value in the corresponding row of psiY.
source
ICA_BlindSourceSeparation.solve_hessianMethod
solve_hessian(G, h)

Compute the product of the inverse Hessian approximation with the gradient.

Arguments

  • G::AbstractMatrix{<:Real}: the gradient matrix.
  • h::AbstractMatrix{<:Real}: diagonal approximation of the Hessian.

Returns

  • A matrix of same size as G, where each element is G[i,j] / h[i,j].
source
ICA_BlindSourceSeparation.whiten_datasetMethod
whiten_dataset(X::sensorData, m::Int64) -> sensorData, W::Matrix{Float64}, iW::Matrix{Float64}

Applies PCA whitening to TxN data matrix to decorrelate m sources T: number of samples n: number of sensors m: number of sources Returns the whitened dataset (Txm data matrix), whitening matrix W (mxn), pseudo-inverse whitening matrix iW (nxm)

source