pyFDN.FlatMagnitude#
- class pyFDN.FlatMagnitude(target=1.0, *, channels='sum')[source]#
Mean squared error of \(|H|\) against a flat target – colorless.
Fits the magnitude spectrum of the (rectangularly truncated) impulse response to a constant, after Differentiable FDNs for Colorless Reverberation (Dal Santo et al.). Its frequency resolution is the model’s
nfft, which makes the fit sensitive to it; see the design note andFlatSpectrogramfor a resolution-independent alternative.- Parameters:
target (
float) – The flat magnitude to fit. The default of 1 matchespyFDN.build_fdn()’s normalized input/output gains, which put the initial \(|H|\) near unity.channels (
Literal['sum','mean','none']) – How the output channels are combined before the comparison."sum"(default) reproduces FLAMO’smse_lossconvention."none"fits each input/output pair to flat on its own, the well-posed choice for a multi-output FDN.
Notes
The optimization crosses long plateaus on this objective;
train_fdn’s defaultpatience=10stops inside one. Raise it (~100) for a converged fit. A lossless FDN has every pole exactly on the unit circle, where the frequency-domain evaluation breaks down;check()warns if the model was built without thealias_decay_dbthat avoids it.Methods
__init__([target, channels])check(model)Preflight against the model it will train, before the first step.
terms()Flatten into
(weight, loss)leaves.Attributes
nameShort label, used as the key in
pyFDN.TrainLog.loss_log.