diff --git a/dev/update-examples.sh b/dev/update-examples.sh index 83dff474c855..c802e21503b7 100755 --- a/dev/update-examples.sh +++ b/dev/update-examples.sh @@ -22,9 +22,14 @@ cd examples/ for d in $(printf '%s\n' */ | sort -V); do example=${d%/} # For each example, copy the README into the source of the Example docs - [[ $example = doc ]] || cp $example/README.md $ROOT/examples/doc/source/$example.md 2>&1 >/dev/null + [[ $example != doc ]] && cp $example/README.md $ROOT/examples/doc/source/$example.md 2>&1 >/dev/null + # For each example, copy all images of the _static folder into the examples + # docs static folder + [[ $example != doc ]] && [ -d "$example/_static" ] && { + cp $example/_static/**.{jpg,png,jpeg} $ROOT/examples/doc/source/_static/ 2>/dev/null || true + } # For each example, insert the name of the example into the index file - [[ $example = doc ]] || (echo $INSERT_LINE; echo a; echo $example; echo .; echo wq) | ed $INDEX 2>&1 >/dev/null + [[ $example != doc ]] && (echo $INSERT_LINE; echo a; echo $example; echo .; echo wq) | ed $INDEX 2>&1 >/dev/null done echo "\`\`\`" >> $INDEX diff --git a/doc/locales/zh_Hans/LC_MESSAGES/framework-docs.po b/doc/locales/zh_Hans/LC_MESSAGES/framework-docs.po index f077264b4aab..87af28422d56 100644 --- a/doc/locales/zh_Hans/LC_MESSAGES/framework-docs.po +++ b/doc/locales/zh_Hans/LC_MESSAGES/framework-docs.po @@ -3,59 +3,60 @@ # This file is distributed under the same license as the Flower package. # FIRST AUTHOR , 2023. # -#, fuzzy msgid "" msgstr "" "Project-Id-Version: Flower main\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2023-11-23 18:31+0100\n" -"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" -"Last-Translator: FULL NAME \n" +"PO-Revision-Date: 2023-11-25 19:00+0000\n" +"Last-Translator: Yan Gao \n" +"Language-Team: Chinese (Simplified) \n" "Language: zh_Hans\n" -"Language-Team: zh_Hans \n" -"Plural-Forms: nplurals=1; plural=0;\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=utf-8\n" "Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=1; plural=0;\n" +"X-Generator: Weblate 5.2.1-rc\n" "Generated-By: Babel 2.13.1\n" #: ../../source/contributor-explanation-architecture.rst:2 msgid "Flower Architecture" -msgstr "" +msgstr "Flower的架构" #: ../../source/contributor-explanation-architecture.rst:5 msgid "Edge Client Engine" -msgstr "" +msgstr "边缘客户端引擎" #: ../../source/contributor-explanation-architecture.rst:7 msgid "" "`Flower `_ core framework architecture with Edge " "Client Engine" -msgstr "" +msgstr "具有边缘客户端引擎的`Flower `核心架构" #: ../../source/contributor-explanation-architecture.rst:13 msgid "Virtual Client Engine" -msgstr "" +msgstr "虚拟客户端引擎" #: ../../source/contributor-explanation-architecture.rst:15 msgid "" "`Flower `_ core framework architecture with Virtual " "Client Engine" -msgstr "" +msgstr "具有虚拟客户端引擎的`Flower `核心架构" #: ../../source/contributor-explanation-architecture.rst:21 msgid "Virtual Client Engine and Edge Client Engine in the same workload" -msgstr "" +msgstr "可同步进行的虚拟客户端引擎和边缘客户端引擎" #: ../../source/contributor-explanation-architecture.rst:23 msgid "" "`Flower `_ core framework architecture with both " "Virtual Client Engine and Edge Client Engine" -msgstr "" +msgstr "具有虚拟客户端引擎和边缘客户端引擎的`Flower `核心架构" #: ../../source/contributor-how-create-new-messages.rst:2 msgid "Creating New Messages" -msgstr "" +msgstr "创建新信息" #: ../../source/contributor-how-create-new-messages.rst:4 msgid "" @@ -13605,4 +13606,3 @@ msgid "" "pytorch.html>`__ shows how to build a simple federated learning system " "with PyTorch and Flower." msgstr "" - diff --git a/doc/source/tutorial-quickstart-xgboost.rst b/doc/source/tutorial-quickstart-xgboost.rst index 111920d5602b..7eb58da7f2f6 100644 --- a/doc/source/tutorial-quickstart-xgboost.rst +++ b/doc/source/tutorial-quickstart-xgboost.rst @@ -2,13 +2,16 @@ Quickstart XGBoost -================== +===================== .. meta:: :description: Check out this Federated Learning quickstart tutorial for using Flower with XGBoost to train classification models on trees. +.. youtube:: AY1vpXUpesc + :width: 100% + Federated XGBoost -------------- +------------------- EXtreme Gradient Boosting (**XGBoost**) is a robust and efficient implementation of gradient-boosted decision tree (**GBDT**), that maximises the computational boundaries for boosted tree methods. It's primarily designed to enhance both the performance and computational speed of machine learning models. @@ -17,7 +20,7 @@ In XGBoost, trees are constructed concurrently, unlike the sequential approach t Often, for tabular data on medium-sized datasets with fewer than 10k training examples, XGBoost surpasses the results of deep learning techniques. Why federated XGBoost? -~~~~~~~~ +~~~~~~~~~~~~~~~~~~~~~~~~~ Indeed, as the demand for data privacy and decentralized learning grows, there's an increasing requirement to implement federated XGBoost systems for specialised applications, like survival analysis and financial fraud detection. @@ -31,7 +34,7 @@ and then we dive into a more complex example (`full code xgboost-comprehensive < Environment Setup -------------- +-------------------- First of all, it is recommended to create a virtual environment and run everything within a `virtualenv `_. @@ -49,7 +52,7 @@ Since we want to use :code:`xgboost` package to build up XGBoost trees, let's go Flower Client -------------- +----------------- *Clients* are responsible for generating individual weight-updates for the model based on their local datasets. Now that we have all our dependencies installed, let's run a simple distributed training with two clients and one server. @@ -81,7 +84,7 @@ In a file called :code:`client.py`, import xgboost, Flower, Flower Datasets and from flwr_datasets.partitioner import IidPartitioner Dataset partition and hyper-parameter selection -~~~~~~~~ +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Prior to local training, we require loading the HIGGS dataset from Flower Datasets and conduct data partitioning for FL: @@ -175,7 +178,7 @@ We use AUC as evaluation metric. Flower client definition for XGBoost -~~~~~~~~ +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ After loading the dataset we define the Flower client. We follow the general rule to define :code:`XgbClient` class inherited from :code:`fl.client.Client`. @@ -303,7 +306,7 @@ clients running on different machines, all that needs to change is the Flower Server -------------- +------------------ These updates are then sent to the *server* which will aggregate them to produce a better model. Finally, the *server* sends this improved version of the model back to each *client* to finish a complete FL round. @@ -348,7 +351,7 @@ Then, we start the server: ) Tree-based bagging aggregation -~~~~~~~~ +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ You must be curious about how bagging aggregation works. Let's look into the details. @@ -517,7 +520,7 @@ followed by the serialisation, and sending back to each client. Launch Federated XGBoost! ---------------------------- +------------------------------- With both client and server ready, we can now run everything and see federated learning in action. FL systems usually have a server and multiple clients. We @@ -588,7 +591,7 @@ The full `source code `_), @@ -596,7 +599,7 @@ we provide more options to define various experimental setups, including data pa Let's take a look! Customised data partitioning -~~~~~~~~ +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In :code:`dataset.py`, we have a function :code:`instantiate_partitioner` to instantiate the data partitioner based on the given :code:`num_partitions` and :code:`partitioner_type`. @@ -629,7 +632,7 @@ Currently, we provide four supported partitioner type to simulate the uniformity Customised centralised/distributed evaluation -~~~~~~~~ +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ To facilitate centralised evaluation, we define a function in :code:`server.py`: @@ -670,7 +673,7 @@ As for distributed evaluation on the clients, it's same as the quick-start examp overriding the :code:`evaluate()` method insides the :code:`XgbClient` class in :code:`client.py`. Arguments parser -~~~~~~~~ +~~~~~~~~~~~~~~~~~~~~~~ In :code:`utils.py`, we define the arguments parsers for clients and server, allowing users to specify different experimental settings. Let's first see the sever side: @@ -761,7 +764,7 @@ This defines various options for client data partitioning. Besides, clients also have a option to conduct evaluation on centralised test set by setting :code:`--centralised-eval`. Example commands -~~~~~~~~ +~~~~~~~~~~~~~~~~~~~~~ To run a centralised evaluated experiment on 5 clients with exponential distribution for 50 rounds, we first start the server as below: @@ -776,4 +779,4 @@ Then, on each client terminal, we start the clients: $ python3 clients.py --num-partitions=5 --partitioner-type=exponential --node-id=NODE_ID -The full `source code `_ for this comprehensive example can be found in :code:`examples/xgboost-comprehensive`. +The full `code `_ for this comprehensive example can be found in :code:`examples/xgboost-comprehensive`. diff --git a/examples/doc/source/_static/.gitignore b/examples/doc/source/_static/.gitignore new file mode 100644 index 000000000000..c2412a5912cc --- /dev/null +++ b/examples/doc/source/_static/.gitignore @@ -0,0 +1,5 @@ +* +!custom.css +!favicon.ico +!flower-logo.png +!tmux_jtop_view.gif diff --git a/examples/doc/source/_static/diagram.png b/examples/doc/source/_static/diagram.png deleted file mode 100644 index 66d8855c859f..000000000000 Binary files a/examples/doc/source/_static/diagram.png and /dev/null differ