Repository navigation
docs: add how-to guides for custom algorithms, datasets and optimizers - #62
Merged
Merged
Conversation
- howto-custom-algorithm: walk through the complete custom algorithm in test-files/custom_alg.py — config classes with validators, the server downlink/aggregation hooks, the client typed uplink contract and its parallel-safety rationale, named parameter exchange, registration, and the two layers (golden regression, hook contract) that protect registered algorithms; the legacy hook style is documented as sequential-only - howto-custom-dataset: the full FedVisionDataset-based example plus a minimal NumPy-to-federated template, verified by execution; the template documents three easy-to-miss conventions (FedDataset has no constructor of its own, get_dataloader must handle client_idx=None, candidate models should be fl-sim models) - howto-custom-optimizer: the optimizer registry, ProxSGD subclassing, name-based selection and its caveats - test-files/custom_*.py: add literalinclude fragment markers (comments only; test_custom.py still passes) - index.rst: new How-to guides toctree section; the CLI tutorial's next steps now link the how-tos instead of promising them - zh_CN translations for the new and updated pages
Align the phrasing with the rest of the documentation: "research lives
in the variations" becomes a plain declarative opening, question
headings become noun phrases ("When do you need this?" -> "When is a
custom algorithm needed?"), and metaphorical wording is replaced ("How
your algorithm is kept honest" -> "Safeguards for registered
algorithms", "two things bundled together" -> "combines two
components", "look intimidating" -> "appear required", "the
lightest of the three how-tos" -> "the shortest of the three
guides"). The zh_CN translations are reworded to match. No technical
content changes.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #62 +/- ##
==========================================
+ Coverage 83.72% 83.79% +0.07%
==========================================
Files 55 55
Lines 5640 5640
==========================================
+ Hits 4722 4726 +4
+ Misses 918 914 -4 🚀 New features to boost your workflow:
|
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.
Summary
Same content as #60 (which developed merge conflicts against the squashed history of #59), rebased as a clean two-commit series.
test-files/custom_alg.py— config classes with validators, the server downlink/aggregation hooks, the client typed uplink contract with its parallel-safety rationale, named parameter exchange, registration, and the two layers (golden regression + hook contract) that protect registered algorithms. The legacycommunicate(self, target)style is documented as sequential-only.FedVisionDataset-based example, plus a minimal "NumPy arrays to federated dataset" template verified by execution; the template documents three easy-to-miss conventions (the abstractFedDatasetbase has no constructor of its own;get_dataloadermust handleclient_idx=None;candidate_modelsshould return fl-sim models).ProxSGDsubclassing, name-based selection, and the caveats.test-files/custom_*.py: literalinclude fragment markers added (comments only;test/test_custom.pypasses unchanged).index.rst: new How-to guides toctree section; the CLI tutorial's next-steps link the how-tos.Validation
pytest test/test_tutorial_scripts.py test/test_custom.py: 8 passed.