mixle.data.partition moduleΒΆ
Structure-aware partitioning β one place that splits a dataset into chunks while honoring its
SampleStructure.
This replaces the inline striding in seq_encode (data[i::C]). For strideable structures
(IID / exchangeable / sequential-records) it reproduces that striding exactly, so the existing fast path
is bit-identical. For PARTIALLY_EXCHANGEABLE data it strides at the group level β every record of
a group lands in the same partition β so a hierarchical model never sees a group split across chunks.
- partition_records(records, structure, n)[source]
Split
recordsintonpartitions respectingstructure.Strideable structures give
records[k::n](identical to the historical chunking); a partially-exchangeable structure groups by its key and round-robins whole groups across partitions.
- num_chunks_for(size, num_chunks=1, chunk_size=None)[source]
Resolve the chunk count from an explicit
num_chunksor a targetchunk_size(as seq_encode does).
- encode_partitions(records, encoder, structure=EXCHANGEABLE, num_chunks=1, chunk_size=None)[source]
Partition
recordsbystructureandencoder.seq_encodeeach part ->[(count, payload)].