Skip to content

Conversation

@christofilojohn
Copy link

@christofilojohn christofilojohn commented Nov 23, 2025

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

  • Implement proposed change
  • Write tests
  • Update documentation
  • Make CI checks pass
  • Ping maintainers on Slack (channel #contributions)

@github-actions github-actions bot added the Contributor Used to determine what PRs (mainly) come from external contributors. label Nov 23, 2025
@christofilojohn christofilojohn changed the title Feature Election algorithm tests using the Flower framework Feature Election algorithm implementation using the Flower framework Nov 24, 2025
@yan-gao-GY
Copy link
Contributor

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 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.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.

@christofilojohn
Copy link
Author

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.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.

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

@yan-gao-GY yan-gao-GY self-requested a review November 26, 2025 17:22
@yan-gao-GY
Copy link
Contributor

Hi Ioannis @christofilojohn, maybe the README.md has been ignored. Can you try git add -f README.md before git commit?

@christofilojohn
Copy link
Author

Yes I will fix it thank you.
Let me first update to better follow your setup and then it will be more accurate.

@christofilojohn
Copy link
Author

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

@yan-gao-GY
Copy link
Contributor

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.

@christofilojohn
Copy link
Author

christofilojohn commented Nov 27, 2025

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

@yan-gao-GY
Copy link
Contributor

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.

@christofilojohn
Copy link
Author

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.

@christofilojohn
Copy link
Author

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

Copy link
Contributor

@yan-gao-GY yan-gao-GY left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @christofilojohn Thanks a lot for the update, and sorry for the delay! I've just made some suggested changes mainly for readme.

For pyproject.toml, we can remove the part of tool.pytest, tool.mypy and tool.isort. Instead, we can use Flower build-in test tool to format the code. Could you run ./dev/format.sh and ./dev/test.sh under flower root directory?

@christofilojohn
Copy link
Author

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

@christofilojohn
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Contributor Used to determine what PRs (mainly) come from external contributors.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants