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

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]