kaira.metrics.signal.BitErrorRate

Inheritance diagram of BitErrorRate

Inheritance diagram for BitErrorRate

class kaira.metrics.signal.BitErrorRate(threshold: float = 0.5, name: str | None = None, *args: Any, **kwargs: Any)[source]

Bases: BaseMetric

Bit Error Rate (BER) metric.

BER measures the number of bit errors divided by the total number of bits transmitted. Lower values indicate better performance. BER is one of the most common figure of merit used to assess systems that transmit digital data from one location to another [Proakis and Salehi, 2007] and serves as the cornerstone for performance evaluation in communications [Barry et al., 2003].

threshold

Threshold for binary decision (default: 0.5).

Type:

float

total_bits

Accumulated total number of bits processed.

Type:

Tensor

error_bits

Accumulated number of bit errors.

Type:

Tensor

Methods

__init__

Initialize the BER metric.

compute

Compute the accumulated BER.

compute_with_stats

Compute metric with mean and standard deviation.

forward

Compute the Bit Error Rate for the current batch.

reset

Reset accumulated statistics.

update

Update accumulated statistics with results from a new batch.

Attributes

higher_is_better

is_differentiable

Examples using kaira.metrics.signal.BitErrorRate

Fading Channels in Wireless Communications

Fading Channels in Wireless Communications

Poisson Channel for Signal-Dependent Noise

Poisson Channel for Signal-Dependent Noise

Rician Fading vs Rayleigh Fading Channels

Rician Fading vs Rayleigh Fading Channels

Modulation Schemes Comparison

Modulation Schemes Comparison

Higher-Order PSK Modulation

Higher-Order PSK Modulation

Higher-Order QAM Modulation

Higher-Order QAM Modulation

Offset QPSK Modulation

Offset QPSK Modulation

Pulse Amplitude Modulation (PAM)

Pulse Amplitude Modulation (PAM)

π/4-QPSK Modulation

π/4-QPSK Modulation

Phase-Shift Keying (PSK) Modulation

Phase-Shift Keying (PSK) Modulation

Quadrature Amplitude Modulation (QAM)

Quadrature Amplitude Modulation (QAM)

Composite Metrics

Composite Metrics

Creating Custom Metrics

Creating Custom Metrics

Metrics Registry

Metrics Registry

Signal and Error Rate Metrics

Signal and Error Rate Metrics
is_differentiable = False
higher_is_better = False
__init__(threshold: float = 0.5, name: str | None = None, *args: Any, **kwargs: Any)[source]

Initialize the BER metric.

Parameters:
  • threshold (float) – Threshold for binary decision (default: 0.5)

  • name (Optional[str]) – Optional name for the metric

  • *args – Variable length argument list passed to the base class.

  • **kwargs – Arbitrary keyword arguments passed to the base class.

forward(x: Tensor, y: Tensor, *args: Any, **kwargs: Any) Tensor[source]

Compute the Bit Error Rate for the current batch.

Parameters:
  • x (Tensor) – The transmitted/original tensor.

  • y (Tensor) – The received/predicted tensor.

  • *args – Variable length argument list (unused).

  • **kwargs – Arbitrary keyword arguments (unused).

Returns:

Bit error rate for the batch.

Return type:

Tensor

update(x: Tensor, y: Tensor, *args: Any, **kwargs: Any) None[source]

Update accumulated statistics with results from a new batch.

Parameters:
  • x (Tensor) – The transmitted/original tensor for the current batch.

  • y (Tensor) – The received/predicted tensor for the current batch.

  • *args – Variable length argument list (unused).

  • **kwargs – Arbitrary keyword arguments (unused).

compute() Tensor[source]

Compute the accumulated BER.

Returns:

Accumulated BER

Return type:

Tensor

reset() None[source]

Reset accumulated statistics.

compute_with_stats(x: Tensor, y: Tensor, *args: Any, **kwargs: Any) Tuple[Tensor, Tensor]

Compute metric with mean and standard deviation.

Parameters:
  • x (torch.Tensor) – The first input tensor (typically predictions)

  • y (torch.Tensor) – The second input tensor (typically targets)

  • *args – Variable length argument list.

  • **kwargs – Arbitrary keyword arguments.

Returns:

Mean and standard deviation of the metric

Return type:

Tuple[torch.Tensor, torch.Tensor]

get_expected_args()

Return expected argument names for the metric.