Skip to content

[SYSTEMDS-3789] Fix the CovarianceFEDInstruction for weighted covariance #2137

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

Closed
wants to merge 4 commits into from

Conversation

gaturchenko
Copy link
Contributor

Previous implementation of the CovarianceFEDInstruction worked correctly only for regular federated covariance. The following issues were discovered when tested for the weighted covariance case:

  1. In the processCov method the value to the wtBlock variable was assigned incorrectly, as input2 which is the second input matrix was used instead of the weights matrix stored as input3. Moreover, the slice method should be called for wtBlock as well when passed as an argument to the executeFederatedOperation method.
  2. The processMean method was implemented incorrectly for the case of weighted covariance. In its previous implementation it modified the original instruction string so as to execute the uamean instruction. However, in order to calculate weighted covariance weighted mean is required. Therefore, the method was substantially modified to make sure the proper mean values are calculated.
  3. The aggregation of partial results from the federated workers was not implemented properly. To begin with, in the getResponses method mean values were collected only from the second and third federated worker. Then, in the aggCov method the implementation did not support the aggregation of weighted means, since in this case the sum of weights should be employed instead of vector lengths per worker. Both methods were modified to ensure the correct aggregation of covariance.

Copy link

codecov bot commented Nov 15, 2024

Codecov Report

Attention: Patch coverage is 99.55947% with 1 line in your changes missing coverage. Please review.

Project coverage is 71.15%. Comparing base (553d30c) to head (2aa5bd9).
Report is 4 commits behind head on main.

Files with missing lines Patch % Lines
...ime/instructions/fed/CovarianceFEDInstruction.java 99.55% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main    #2137      +/-   ##
============================================
+ Coverage     71.08%   71.15%   +0.07%     
- Complexity    43274    43307      +33     
============================================
  Files          1449     1449              
  Lines        165323   165503     +180     
  Branches      32249    32262      +13     
============================================
+ Hits         117520   117767     +247     
+ Misses        38610    38552      -58     
+ Partials       9193     9184       -9     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@mboehm7
Copy link
Contributor

mboehm7 commented Nov 17, 2024

LGTM - thanks for catching and fixing this issue @gaturchenko. During the merge I fixed only minor formatting issues (tabs over spaces, and too verbose parameter lists)

@mboehm7 mboehm7 closed this in 1d1b008 Nov 17, 2024
@gaturchenko gaturchenko deleted the dev branch November 18, 2024 09:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants