class
Snr
PythonSnr(name='snr', **kwargs={})Signal-to-Noise Ratio (SNR) metric where y_true: signal y_pred: signal + noise
Example:
# Create 4-second sine wave w/ freq=4, amplitude=1, Fs=1000Hzt = np.linspace(0, 4, 4 * 1000, endpoint=False)x = np.sin(2 * np.pi * 4 * t)# Add random noise with amplitude 0.1noise = np.random.normal(0, 0.1, len(t))y = x + noiseimport helia_edge as helia
snr = helia.metrics.Snr()snr.update_state(x, y)print(snr.result())Parameters
| Name | Type | Default | Description |
|---|---|---|---|
name | str | 'snr' | Name of the metric. Defaults to 'snr'. |
attribute
num
Pythonnum = self.add_variable(shape=(), initializer='zeros', name='num')attribute
den
Pythonden = self.add_variable(shape=(), initializer='zeros', name='den')method
update_state
Pythonupdate_state(y_true, y_pred, sample_weight=None)method
result
PythonComputes the SNR in dB.
result()Computes the SNR in dB.
method
get_config
Pythonget_config()method
reset_state
Pythonreset_state()