Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add tests for Fed EVal #1296

Merged
merged 24 commits into from
Jan 27, 2025
Merged

Add tests for Fed EVal #1296

merged 24 commits into from
Jan 27, 2025

Conversation

payalcha
Copy link
Contributor

@payalcha payalcha commented Jan 22, 2025

Add tests for FedEval
Steps -

  1. Create a workspace and train the data using task_group learning
  2. Note down the last round aggregated_model_validation/accuracy
  3. Create a new workspace for evaluation
  4. Copy the best model of prev round to initial model in the workspace
  5. Run with task_group evaluation
  6. Validate that both accuracy is +- 1%
    Also change the mounting process of dockerize job

Create workflow file for the tests

Jobs -
Regression -
https://github.com/payalcha/openfl/actions/runs/12926470885
https://github.com/payalcha/openfl/actions/runs/12926488973

Added tests -
https://github.com/payalcha/openfl/actions/runs/12943482432
https://github.com/payalcha/openfl/actions/runs/12943483520

Signed-off-by: Chaurasiya, Payal <[email protected]>
@payalcha payalcha marked this pull request as draft January 22, 2025 11:07
Signed-off-by: Chaurasiya, Payal <[email protected]>
Signed-off-by: Chaurasiya, Payal <[email protected]>
Signed-off-by: Chaurasiya, Payal <[email protected]>
Signed-off-by: Chaurasiya, Payal <[email protected]>
Signed-off-by: Chaurasiya, Payal <[email protected]>
Signed-off-by: Chaurasiya, Payal <[email protected]>
Signed-off-by: Chaurasiya, Payal <[email protected]>
Signed-off-by: Chaurasiya, Payal <[email protected]>
Signed-off-by: Chaurasiya, Payal <[email protected]>
Signed-off-by: Chaurasiya, Payal <[email protected]>
Signed-off-by: Chaurasiya, Payal <[email protected]>
Signed-off-by: Chaurasiya, Payal <[email protected]>
Signed-off-by: Chaurasiya, Payal <[email protected]>
@payalcha payalcha marked this pull request as ready for review January 23, 2025 10:19
tests/end_to_end/utils/tr_workspace.py Show resolved Hide resolved
tests/end_to_end/utils/tr_workspace.py Show resolved Hide resolved
tests/end_to_end/utils/tr_workspace.py Outdated Show resolved Hide resolved
tests/end_to_end/utils/tr_workspace.py Outdated Show resolved Hide resolved
tests/end_to_end/models/aggregator.py Show resolved Hide resolved
tests/end_to_end/models/model_owner.py Outdated Show resolved Hide resolved
tests/end_to_end/models/model_owner.py Outdated Show resolved Hide resolved
tests/end_to_end/test_suites/tr_with_eval_tests.py Outdated Show resolved Hide resolved
tests/end_to_end/test_suites/tr_with_eval_tests.py Outdated Show resolved Hide resolved
.github/workflows/task_runner_eval_dws_e2e.yml Outdated Show resolved Hide resolved
Signed-off-by: Chaurasiya, Payal <[email protected]>
Signed-off-by: Chaurasiya, Payal <[email protected]>
Comment on lines +31 to +32
assert fed_helper.verify_federation_run_completion(
fx_federation_tr,

Check notice

Code scanning / Bandit

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
Comment on lines +48 to +49
assert fed_helper.verify_federation_run_completion(
new_fed_obj,

Check notice

Code scanning / Bandit

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
log.info(f"Model accuracy during evaluation only on prev trained model is : {model_accuracy_eval})")

# verify that the model accuracy is similar to the previous model accuracy max of 1% difference
assert abs(model_accuracy - model_accuracy_eval) <= 0.01, "Model accuracy is not similar to the previous model accuracy"

Check notice

Code scanning / Bandit

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
Comment on lines +77 to +78
assert fed_helper.verify_federation_run_completion(
fx_federation_tr_dws,

Check notice

Code scanning / Bandit

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
Comment on lines +95 to +96
assert fed_helper.verify_federation_run_completion(
new_fed_obj,

Check notice

Code scanning / Bandit

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
log.info(f"Model accuracy during evaluation only on prev trained model is : {model_accuracy_eval})")

# verify that the model accuracy is similar to the previous model accuracy max of 1% difference
assert abs(model_accuracy - model_accuracy_eval) <= 0.01, "Model accuracy is not similar to the previous model accuracy"

Check notice

Code scanning / Bandit

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
Copy link
Collaborator

@ishaileshpant ishaileshpant left a comment

Choose a reason for hiding this comment

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

Some minor changes requested - rest LGTM 👍

@tanwarsh tanwarsh merged commit fd1a23d into securefederatedai:develop Jan 27, 2025
22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants