contiguous_split#
- fedcausal.data.contiguous_split(ds, n_clients)[source]#
Split a dataset into contiguous row blocks, in original order.
Client
cgets rowsceil(c * n / N)up toceil((c + 1) * n / N), so concatenating the blocks in order rebuilds the dataset. The remainder is spread across the blocks:n=10, N=4gives sizes[3, 2, 3, 2].- Parameters:
- dsDiscreteDataset or ContinuousDataset
The dataset to split.
- n_clientsint
Number of clients (blocks) to produce. Must be positive.
- Returns:
- list[DiscreteDataset] or list[ContinuousDataset]
n_clients datasets over the same variables as ds. If n_clients exceeds ds.n_rows, some blocks are empty.
- Raises:
- ValueError
If n_clients is not positive.