pyFDN.MatchMelMagnitude#

class pyFDN.MatchMelMagnitude(target, *, n_mels=128, f_min=0.0, f_max=None, channels='none')[source]#

Mel-scaled mean squared error of \(|H|\) against a reference.

The mel sibling of MatchMagnitude: both spectra are reduced to n_mels mel bands (via torchaudio’s triangular filterbank) before comparing, weighting the fit towards the low frequencies where mel spacing resolves more finely, at the cost of resolution in the high ones.

Parameters:
  • target (Any) – Reference IR, shape (n_samples,), (n_samples, n_out) or (n_samples, n_out, n_in). Zero-padded or truncated to the model’s nfft.

  • n_mels (int) – Number of mel bands. Default 128.

  • f_min (float) – Mel filterbank frequency range in Hz. f_max defaults to Nyquist.

  • f_max (float | None) – Mel filterbank frequency range in Hz. f_max defaults to Nyquist.

  • channels (Literal['sum', 'mean', 'none']) – How the output channels are combined before the comparison. "none" (default) fits each input/output pair on its own, the well-posed choice for a multi-output FDN.

__init__(target, *, n_mels=128, f_min=0.0, f_max=None, channels='none')[source]#

Methods

__init__(target, *[, n_mels, f_min, f_max, ...])

check(model)

Preflight against the model it will train, before the first step.

terms()

Flatten into (weight, loss) leaves.

Attributes

name

Short label, used as the key in pyFDN.TrainLog.loss_log.