ssspy.bss.cacgmm#
Algorithms#
- class ssspy.bss.cacgmm.CACGMM(n_sources=None, flooring_fn=functools.partial(<function max_flooring>, eps=1e-10), callbacks=None, normalization=True, solve_permutation=True, record_loss=True, reference_id=0, rng=None)#
Complex angular central Gaussian mixture model (cACGMM) [1].
- Parameters:
n_sources (int, optional) – Number of sources to be separated. If
Noneis given,n_sourcesis determined by number of channels in input spectrogram. Default:None.flooring_fn (callable, optional) – A flooring function for numerical stability. This function is expected to return the same shape tensor as the input. If you explicitly set
flooring_fn=None, the identity function (lambda x: x) is used.callbacks (callable or list[callable], optional) – Callback functions. Each function is called before separation and at each iteration. Default:
None.normalization (bool) – If
Trueis given, normalization is applied to covariance in cACG.solve_permutation (bool) – If
solve_permutation=True, a permutation solver is used to align estimated spectrograms. Default:True.record_loss (bool) – Record the loss at each iteration of the update algorithm if
record_loss=True. Default:True.reference_id (int) – Reference channel to extract separated signals. Default:
0.rng (numpy.random.Generator, optioinal) – Random number generator. This is mainly used to randomly initialize parameters of cACGMM. If
Noneis given,np.random.default_rng()is used. Default:None.
Note
The estimated spectrograms are aligned by similarity of their power.
- __call__(input, n_iter=100, initial_call=True, **kwargs)#
Separate a frequency-domain multichannel signal.
- Parameters:
input (numpy.ndarray) – The mixture signal in frequency-domain. The shape is (n_channels, n_bins, n_frames).
n_iter (int) – The number of iterations of demixing filter updates. Default:
100.initial_call (bool) – If
True, perform callbacks (and computation of loss if necessary) before iterations.
- Return type:
ndarray- Returns:
numpy.ndarray of the separated signal in frequency-domain. The shape is (n_channels, n_bins, n_frames).
- compute_loss()#
Compute loss of cACGMM \(\mathcal{L}\).
\(\mathcal{L}\) is defined as follows: :rtype:
float\[\mathcal{L} = -\frac{1}{J}\sum_{i,j}\log\left( \sum_{n}\frac{\alpha_{in}}{\det\boldsymbol{B}_{in}} \frac{1}{(\boldsymbol{z}_{ij}^{\mathsf{H}}\boldsymbol{B}_{in}^{-1}\boldsymbol{z}_{ij})^{M}} \right).\]
- normalize_covariance()#
Normalize covariance of cACG. :rtype:
None\[\boldsymbol{B}_{in} \leftarrow\frac{\boldsymbol{B}_{in}}{\mathrm{tr}(\boldsymbol{B}_{in})}\]
- separate(input, posterior=None)#
Separate
inputusing posterior probabilities.In this method,
self.posterioris not updated.- Parameters:
input (numpy.ndarray) – The mixture signal in frequency-domain. The shape is (n_channels, n_bins, n_frames).
posterior (numpy.ndarray, optional) – Posterior probability. If not specified,
posterioris computed by current parameters.
- Return type:
ndarray- Returns:
numpy.ndarray of the separated signal in frequency-domain. The shape is (n_sources, n_bins, n_frames).
- update_once()#
Perform E and M step once.
In
update_posterior, posterior probabilities are updated, which corresponds to E step. Inupdate_parameters, parameters of cACGMM are updated, which corresponds to M step.- Return type:
None
- update_parameters()#
Update parameters of mixture of complex angular central Gaussian distributions.
This method corresponds to M step in EM algorithm for cACGMM.
- Return type:
None
- update_posterior()#
Update posteriors.
This method corresponds to E step in EM algorithm for cACGMM.
- Return type:
None