Skip to content

docs: add how-to guides for custom algorithms, datasets and optimizers - #62

Merged
wenh06 merged 2 commits into
masterfrom
docs-tutorials-d2
Oct 29, 2026
Merged

wenh06 merged 2 commits into
masterfrom
docs-tutorials-d2

Conversation

@wenh06

@wenh06 wenh06 commented Oct 29, 2026

Copy link
Copy Markdown
Owner

Summary

Same content as #60 (which developed merge conflicts against the squashed history of #59), rebased as a clean two-commit series.

  • howto-custom-algorithm: walks 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 with its parallel-safety rationale, named parameter exchange, registration, and the two layers (golden regression + hook contract) that protect registered algorithms. The legacy communicate(self, target) style is documented as sequential-only.
  • howto-custom-dataset: the full FedVisionDataset-based example, plus a minimal "NumPy arrays to federated dataset" template verified by execution; the template documents three easy-to-miss conventions (the abstract FedDataset base has no constructor of its own; get_dataloader must handle client_idx=None; candidate_models should return fl-sim models).
  • howto-custom-optimizer: the optimizer registry, ProxSGD subclassing, name-based selection, and the caveats.
  • test-files/custom_*.py: literalinclude fragment markers added (comments only; test/test_custom.py passes unchanged).
  • index.rst: new How-to guides toctree section; the CLI tutorial's next-steps link the how-tos.
  • zh_CN translations for the new and updated pages.

Validation

  • pytest test/test_tutorial_scripts.py test/test_custom.py: 8 passed.
  • English and zh_CN docs builds: zero howto/tutorial warnings.

- 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

codecov Bot commented Oct 29, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 83.79%. Comparing base (3cec68e) to head (fe01269).

Additional details and impacted files

Impacted file tree graph

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

see 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@wenh06
wenh06 merged commit ca84c9b into master Oct 29, 2026
27 of 28 checks passed
@wenh06
wenh06 deleted the docs-tutorials-d2 branch October 29, 2026 16:33
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.

1 participant