fair_forge.utils

Utility functions for Fair Forge.

Functions

batched(len_data, batch_size, *[, drop_last])

Yield slices of indices for batching data.

reproducible_random_state(seed)

Create a random state that is reproducible across Python versions and platforms.

fair_forge.utils.batched(len_data: int, batch_size: int, *, drop_last: bool = False) Generator[slice, None, None][source]

Yield slices of indices for batching data.

Parameters:
  • len_data – The total number of data points.

  • batch_size – The size of each batch.

  • drop_last – If True, the last batch will be dropped if it is smaller than batch_size.

fair_forge.utils.reproducible_random_state(seed: int) Generator[source]

Create a random state that is reproducible across Python versions and platforms.