Feature Election algorithm implementation using the Flower framework
Issue
Description
This work originates from FLASH: A framework for Federated Learning with Attribute Selection and Hyperparameter optimization, a work presented at FLTA IEEE 2025 achieving the Best Student Paper Award.
Feature Election enables multiple clients with tabular datasets to collaboratively identify the most relevant features without sharing raw data. It works by using conventional feature selection algorithms on the client side and performing a weighted aggregation of their results.
Related issues/PRs
Proposal
Explanation
This PR introduces a complete Feature Election workflow including: Custom Strategy (FeatureElectionStrategy): Implements the core aggregation logic using a "Freedom Degree" to balance between Feature Intersection (strict consensus) and Feature Union. Modular Feature Selection: A FeatureSelector utility supporting multiple methods including Lasso, Random Forest, and PyImpetus (Markov Blanket). Synthetic Data Generation: A task.py module that generates synthetic data with consistent informative features across clients (fixed random seed) while allowing for non-IID partitioning, ensuring valid consensus is mathematically possible.
Checklist
- [x] Implement proposed change
- [x] Write tests
- [x] Update documentation
- [ ] Make CI checks pass
- [ ] Ping maintainers on Slack (channel
#contributions)
Hi @christofilojohn, thanks for creating this PR! The example looks very promising. I have a few general comments to help get it merged into the Flower main branch:
-
Could you align the file structure with the other Flower examples (e.g., advanced-pytorch)? The expected structure would look like this:
flash-feature-election/ ├── README.md ├── pyproject.toml └── flash_feature_election ├── server_app.py ├── client_app.py └── ... -
In
README.md, could you briefly introduce the methods used in this example and include a link to the paper (if it’s publicly available)? It would also be great to add:- a section on how to install dependencies,
- a section on how to run the project,
- and some expected results or example outputs.
You can take inspiration from the advanced-pytorch example.
-
All examples in the Flower repository have been updated to the Message API, which is now the default in Flower. We'll need to update this example accordingly before merging the PR into
main. The first step is to update the Flower version inpyproject.tomltoflwr[simulation]>=1.23.0.
Here’s a helpful guide on migrating fromStrategy/NumPyClientto the Message API:
https://flower.ai/docs/framework/how-to-upgrade-to-message-api.html
Thanks again for your contribution! Don’t hesitate to reach out if you have any questions or concerns—I’m more than happy to help, especially with the migration to the Message API.
Hi @christofilojohn, thanks for creating this PR! The example looks very promising. I have a few general comments to help get it merged into the Flower main branch:
* Could you align the file structure with the other Flower examples (e.g., [advanced-pytorch](https://github.com/adap/flower/tree/main/examples/advanced-pytorch))? The expected structure would look like this: ``` flash-feature-election/ ├── README.md ├── pyproject.toml └── flash_feature_election ├── server_app.py ├── client_app.py └── ... ``` * In `README.md`, could you briefly introduce the methods used in this example and include a link to the paper (if it’s publicly available)? It would also be great to add: * a section on how to install dependencies, * a section on how to run the project, * and some expected results or example outputs. You can take inspiration from the [advanced-pytorch](https://github.com/adap/flower/tree/main/examples/advanced-pytorch) example. * All examples in the Flower repository have been updated to the Message API, which is now the default in Flower. We'll need to update this example accordingly before merging the PR into `main`. The first step is to update the Flower version in `pyproject.toml` to `flwr[simulation]>=1.23.0`. Here’s a helpful guide on migrating from `Strategy`/`NumPyClient` to the Message API: https://flower.ai/docs/framework/how-to-upgrade-to-message-api.htmlThanks again for your contribution! Don’t hesitate to reach out if you have any questions or concerns—I’m more than happy to help, especially with the migration to the Message API.
Thank you for your comments and feedback. I will definitely ask questions about the message API and I will fix my code to match the structure. Unfortunately the paper is not publicly available yet, but it will be uploaded on FLTA IEEE proceedings soon. I will try to explain the process better in the documentation, but for some reason the README.md was not pushed. Is there a different location for documentation to be placed? Thanks, Ioannis
Hi Ioannis @christofilojohn, maybe the README.md has been ignored. Can you try git add -f README.md before git commit?
Yes I will fix it thank you. Let me first update to better follow your setup and then it will be more accurate.
I will have the updated file structure and messaging API uploaded soon, but I have a question. In the advanced pytorch example I don't see any licensing headers on the files, so do I follow the same format or do i need to put some headers with APACHE licence given to Flower? Thanks, Ioannis
I will have the updated file structure and messaging API uploaded soon, but I have a question. In the advanced pytorch example I don't see any licensing headers on the files, so do I follow the same format or do i need to put some headers with APACHE licence given to Flower? Thanks, Ioannis
Hi Ioannis @christofilojohn , we don't need to include licensing headers in the files, instead we have a license = "Apache-2.0" entry under [project] in pyproject.toml.
Thank you for your comment, I changed it and it will be there on my next commit (doing some tests). I would like to ask if it’s ok to add my email and the conference name, with pending full citation to the readme, as the full paper url is not yet available, and if I can update on availability, Thanks, Ioannis
Thank you for your comment, I changed it and it will be there on my next commit (doing some tests). I would like to ask if it’s ok to add my email and the conference name, with pending full citation to the readme, as the full paper url is not yet available, and if I can update on availability, Thanks, Ioannis
Absolutely! Apart from the readme, you can also add your name and email in pyproject.toml, similar to this example.
Perfect, thanks for the info. I uploaded a new version based on the Message API (feel free to comment on anything) and added an optional auto tuning method of the 'freedom degree' hyperparameter based on hill-climbing algorithm. The core behavior of the algorithm was also changed a bit, to perform feature election, decide on a global feature mask and then continue on normal FL aggregation rounds - to mirror our implementation in the paper. The README and tests are also updated.
Hello, @yan-gao-GY I uploaded a new version that passes black, ilint and mypy, because I saw that similar tests were on the workflow file. Please let me know if everything is ok or if I need to make any changes, Kind regards, Ioannis
Perfect, I accepted the suggested changes, removed the formatting tools from the project and after running the format script and edinting the Readme to remove special characters, the local tests pass, with only a deprecation warning on the script:
site-packages/beautysh.py:7: UserWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html. The pkg_resources package is slated for removal as early as 2025-11-30. Refrain from using this package or pin to Setuptools<81.
Everything else is fine in the latest commit. Thanks, Ioannis
Hello, @yan-gao-GY Please let me know if there are any more tests for me to run or changes to do for the pull request to proceed, Thanks for the support, Ioannis