kaira.data.datasets.BinaryDataset

Inheritance diagram of BinaryDataset

Inheritance diagram for BinaryDataset

class kaira.data.datasets.BinaryDataset(length: int, shape: int | Tuple[int, ...] = (128,), prob: float = 0.5, seed: int | None = None)[source]

Bases: Dataset

Dataset for binary tensor data with configurable probability.

Generates binary tensors on-demand with specified probability of 1s. Useful for digital communication and coding theory experiments.

Methods

__init__

Initialize the binary dataset.

__init__(length: int, shape: int | Tuple[int, ...] = (128,), prob: float = 0.5, seed: int | None = None)[source]

Initialize the binary dataset.

Parameters:
  • length – Number of samples in the dataset

  • shape – Shape of each tensor (int for 1D, tuple for multi-dimensional)

  • prob – Probability of generating 1s (default: 0.5)

  • seed – Random seed for reproducibility