Feature Election contribution#3876
Open
christofilojohn wants to merge 196 commits intoNVIDIA:mainfrom
Open
Conversation
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
Removed leftover testing code Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
… Most greptile issues resolved
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
Collaborator
|
/build |
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
…ting on training data Might further simplify in the future
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
executor.py: _handle_apply_mask now sets self.global_feature_mask = mask before slicing X_train/X_val, so the executor's state stays consistent with the data that's actually loaded.
controller.py: _aggregate_weights condition simplified from if total_samples > 0 and weighted_weights is not None: to just if total_samples > 0:, removing the dead check (weighted_weights is initialised as {} and is never None).
job.py: n_repeated default (both in the function signature and the argparse default) corrected from 30 to 10, matching prepare_data.py and client.py. Previously, running job.py and prepare_data.py with all defaults would generate inconsistent datasets.
feature_election.py: remaining_X removed from the unpacking at the start of the stratified split loop — it was assigned X and never touched again, leaving a confusing dangling reference.
feature_election.py — NumPy >= 2.0 JSON serialization (save_results): reduction_ratio and freedom_degree in election_stats are wrapped with float(), tuning_history tuples are cast to (float, float), and the election_stats dict comprehension now handles np.floating scalars alongside np.ndarray. The top-level freedom_degree in save_results is also cast to float since it can be np.float64 after auto-tuning sets it from np.clip(...). controller.py — NumPy >= 2.0 JSON serialization (stop_controller): self.freedom_degree is wrapped with float() before writing to feature_election_results.json at workflow teardown. Without this, auto-tuned runs would silently fail to save results. feature_election.py — Missing stratification in simulate_election train/val split: Now mirrors the _safe_train_test_split pattern from prepare_data.py — tries stratify=y_np first, falls back to a plain random split if any class has fewer than 2 samples. This is especially important for Dirichlet-split data where class distributions can be highly skewed. controller.py — FedAvg denominator corruption on weight mismatch total_samples += n ran unconditionally even when a client's weights were skipped due to a shape or key mismatch. This meant the final division v / total_samples under-weighted all valid clients. The fix validates every key for a client before doing any accumulation, and only counts that client's samples if all keys passed. feature_election.py — eval_metric silently ignored FeatureElection.__init__ had no eval_metric parameter, so both simulate_election (executor creation) and create_flare_job (generated client config) hardcoded "f1". Any user passing eval_metric="accuracy" to quick_election or FeatureElection would have it silently discarded. The fix adds eval_metric to __init__ (with validation), stores it as self.eval_metric, wires it through simulate_election and create_flare_job, and persists/restores it in save_results/load_results.
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
Collaborator
|
/build |
Collaborator
Collaborator
|
/build |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes
Implemented all the changes you requested on file format, tests etc. black-check, isort-check, flake8 pass.
Types of changes
./runtest.sh.