# Custom data splitting/partitioning

**URL:** <https://discuss.flower.ai/t/custom-data-splitting-partitioning/1077>\
**Category:** Flower Datasets\
**Created:** [August 13, 2025, 3:20pm UTC](https://discuss.flower.ai/t/custom-data-splitting-partitioning/1077 "2025-08-13T15:20:55Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![gxenos](https://dub1.discourse-cdn.com/flex013/user_avatar/discuss.flower.ai/gxenos/32/171_2.png) [@gxenos](https://discuss.flower.ai/u/gxenos)\
**Post date:** [August 13, 2025, 3:20pm UTC](https://discuss.flower.ai/t/custom-data-splitting-partitioning/1077/1 "2025-08-13T15:20:55Z")

</div>

Hi,

I am working on contributing a baseline and to recreate an experiment from the original paper I have to implement a custom dataset partitioning scheme. Specifically for MNIST the dataset partitioning has to adhere to the following:

“To simulate a heterogeneous setting, we distribute the data among 1000 devices such that each device has samples of only 2 digits and the number of samples per device follows a power law.”

and for an experiment for FEMNIST:

“To generate heterogeneous data partitions, we subsample 10 lower case characters (‘a’-‘j’) from FEMNIST and distribute only 5 classes to each device.”

Is there a way of doing this using Flower Datasets? I read the documentation but didn’t find a way of implementing such schemes.

Thanks

---

<div class="post-metadata">

**Author:** ![williamlm](https://dub1.discourse-cdn.com/flex013/user_avatar/discuss.flower.ai/williamlm/32/162_2.png) [@williamlm](https://discuss.flower.ai/u/williamlm)\
**Post date:** [August 14, 2025, 4:45pm UTC](https://discuss.flower.ai/t/custom-data-splitting-partitioning/1077/2 "2025-08-14T16:45:27Z")

</div>

hi @gxenos,

great question! You could use the [NaturalDPartitioner](https://flower.ai/docs/datasets/ref-api/flwr_datasets.partitioner.NaturalIdPartitioner.html) to split the amount of assigned labels to each client. Try the property **`partition_id_to_natural_id`.**

I think that should work.

Best regards,

William
