# Table of Contents
- [FedEval — FedEval documentation](#fedeval-fedeval-documentation)
- [1. Introduction — FedEval documentation](#1-introduction-fedeval-documentation)
- [3. Tutorial — FedEval documentation](#3-tutorial-fedeval-documentation)
- [2. Environment — FedEval documentation](#2-environment-fedeval-documentation)
- [4. Benchmarks — FedEval documentation](#4-benchmarks-fedeval-documentation)
- [3.1. Quick Start (single experiment using terminal) — FedEval documentation](#3-1-quick-start-single-experiment-using-terminal-fedeval-documentation)
- [3.3. Get to know the three configurations — FedEval documentation](#3-3-get-to-know-the-three-configurations-fedeval-documentation)
- [3.2. Running Multiple Experiments (using scripts) — FedEval documentation](#3-2-running-multiple-experiments-using-scripts-fedeval-documentation)
- [3.4. Get to know the FedEval.run and FedEval.run_util — FedEval documentation](#3-4-get-to-know-the-fedeval-run-and-fedeval-run-util-fedeval-documentation)
- [3.6. Interface of FL Algorithms — FedEval documentation](#3-6-interface-of-fl-algorithms-fedeval-documentation)
- [3.5. Customization — FedEval documentation](#3-5-customization-fedeval-documentation)
- [5. API Reference — FedEval documentation](#5-api-reference-fedeval-documentation)
- [5.1. FedEval — FedEval documentation](#5-1-fedeval-fedeval-documentation)
- [5.1.2.1. FedEval.run — FedEval documentation](#5-1-2-1-fedeval-run-fedeval-documentation)
- [5.1.2.2. FedEval.run_util — FedEval documentation](#5-1-2-2-fedeval-run-util-fedeval-documentation)
- [5.1.1.1. FedEval.aggregator — FedEval documentation](#5-1-1-1-fedeval-aggregator-fedeval-documentation)
- [5.1.1.5. FedEval.model — FedEval documentation](#5-1-1-5-fedeval-model-fedeval-documentation)
- [5.1.1.6. FedEval.role — FedEval documentation](#5-1-1-6-fedeval-role-fedeval-documentation)
- [5.1.1.3. FedEval.config — FedEval documentation](#5-1-1-3-fedeval-config-fedeval-documentation)
- [5.1.1.2. FedEval.communicaiton — FedEval documentation](#5-1-1-2-fedeval-communicaiton-fedeval-documentation)
- [5.1.1.9. FedEval.utils — FedEval documentation](#5-1-1-9-fedeval-utils-fedeval-documentation)
- [5.1.1.7. FedEval.secure_protocols — FedEval documentation](#5-1-1-7-fedeval-secure-protocols-fedeval-documentation)
- [5.1.1.4. FedEval.dataset — FedEval documentation](#5-1-1-4-fedeval-dataset-fedeval-documentation)
- [5.1.1.8. FedEval.strategy — FedEval documentation](#5-1-1-8-fedeval-strategy-fedeval-documentation)
---
# FedEval — FedEval documentation
* [](https://fedeval.readthedocs.io/en/latest/#)
* FedEval
* [Edit on GitHub](https://github.com/Di-Chai/FedEval/blob/master/docs/index.rst)
* * *
FedEval[](https://fedeval.readthedocs.io/en/latest/#fedeval "Link to this heading")
=====================================================================================
A Benchmark System with a Comprehensive Evaluation Model for Federated Learning. [\[GitHub\]](https://github.com/Di-Chai/FedEval)
* [1\. Introduction](https://fedeval.readthedocs.io/en/latest/Introduction.html)
* [1.1. The Evaluation Goals and Measures](https://fedeval.readthedocs.io/en/latest/Introduction.html#the-evaluation-goals-and-measures)
* [1.2. The Evaluation Framework](https://fedeval.readthedocs.io/en/latest/Introduction.html#the-evaluation-framework)
* [2\. Environments](https://fedeval.readthedocs.io/en/latest/Environment.html)
* [2.1. Software Dependencies](https://fedeval.readthedocs.io/en/latest/Environment.html#software-dependencies)
* [2.2. Build the Docker Image](https://fedeval.readthedocs.io/en/latest/Environment.html#build-the-docker-image)
* [2.3. Download the dataset](https://fedeval.readthedocs.io/en/latest/Environment.html#download-the-dataset)
* [3\. Tutorials](https://fedeval.readthedocs.io/en/latest/tutorial/index.html)
* [3.1. Quick Start (single experiment using terminal)](https://fedeval.readthedocs.io/en/latest/tutorial/QuickStart.html)
* [3.2. Running Multiple Experiments (using scripts)](https://fedeval.readthedocs.io/en/latest/tutorial/Procedures.html)
* [3.3. Get to know the three configurations](https://fedeval.readthedocs.io/en/latest/tutorial/Configurations.html)
* [3.4. Get to know the FedEval.run and FedEval.run\_util](https://fedeval.readthedocs.io/en/latest/tutorial/RunUtils.html)
* [3.5. Customization](https://fedeval.readthedocs.io/en/latest/tutorial/Contribute.html)
* [3.6. Interface of FL Algorithms](https://fedeval.readthedocs.io/en/latest/tutorial/StrategyAndCallbacks.html)
* [3.7. Interface of Callback Functions](https://fedeval.readthedocs.io/en/latest/tutorial/StrategyAndCallbacks.html#interface-of-callback-functions)
* [4\. Benchmarks](https://fedeval.readthedocs.io/en/latest/benchmark/benchmark.html)
* [4.1. Experiment Settings](https://fedeval.readthedocs.io/en/latest/benchmark/benchmark.html#experiment-settings)
* [4.2. Radar Chart](https://fedeval.readthedocs.io/en/latest/benchmark/benchmark.html#radar-chart)
* [5\. API Reference](https://fedeval.readthedocs.io/en/latest/autoapi/index.html)
* [5.1. `FedEval`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/index.html)
---
# 1. Introduction — FedEval documentation
* [](https://fedeval.readthedocs.io/en/latest/index.html)
* 1\. Introduction
* [Edit on GitHub](https://github.com/Di-Chai/FedEval/blob/master/docs/Introduction.md)
* * *
1\. Introduction[](https://fedeval.readthedocs.io/en/latest/Introduction.html#introduction "Link to this heading")
====================================================================================================================
1.1. The Evaluation Goals and Measures[](https://fedeval.readthedocs.io/en/latest/Introduction.html#the-evaluation-goals-and-measures "Link to this heading")
---------------------------------------------------------------------------------------------------------------------------------------------------------------

Based on the investigation of existing works, we summarize the evaluation goals of federated learning (FL) into utility, efficiency, and security & privacy. For each of the goals, we summarize the detailed measurements, which form the basis of FedEval (i.e., our evaluation platform). The detailed introduction of the evaluation goals and measures could be found in our survey paper.([Arxiv](https://arxiv.org/abs/2308.11841)
/[IEEE](https://ieeexplore.ieee.org/abstract/document/10480259)
).
1.2. The Evaluation Framework[](https://fedeval.readthedocs.io/en/latest/Introduction.html#the-evaluation-framework "Link to this heading")
---------------------------------------------------------------------------------------------------------------------------------------------

We propose a federated benchmarking system called FedEval shown in the above figure, which demonstrates the inputs, inner architecture, and outputs of the system. To use FedEval, users only need to provide a single script that contains the necessary FL functions or callback functions, such as how the server aggregates the parameters from different clients, to evaluate a new FL algorithm or test new attack/defense methods. The platform consists of three key modules.
* **Data Config and the `FedData` module**: FedEval currently provides seven standard FL datasets, including MNIST, CIFAR10, CIFAR100, FEMNIST, CelebA, Sentiment140, and Shakespeare. Different data settings (e.g., non-IID data) can be implemented by changing the data configs. Self-defined data is also supported. We only need to inherit the `FedData` class and define the `load_data` function to add a new dataset, which will share the same processing functions with the built-in datasets.
* **Model Config and the `Keras.Model` module**: Currently, three machine learning models are built inside our system, including `MLP`, `LeNet`, and `StackedLSTM`. We use TensorFlow as the backend, and all the models are made via subclassing the Keras model. Thus, adding new machine learning models is very simple in FedEval.
* **Runtime Config and the `strategy` module**: One of the essential components in FedEval is the `strategy` module, which defines the protocol of the federated training. Briefly, the FL strategy module supports the following customization:
* **Customized uploading message**, i.e., which parameters are uploaded to the server from the clients.
* **Customized server aggregation method**, e.g., weighted average.
* **Customized training method for clients**, e.g., the clients’ model can be trained using regular gradient descent method or other solutions like knowledge distillation.
* **Customized **methods** for incorporating** the global and local model\*\*, e.g., one popularly used method is replacing the local model with the global one before training.
We use the docker container technology to simulate the server and clients (i.e., each participant is a container), and use socket IO in the communication. The isolation between different containers guarantees that our simulation can reflect the real-world application. The entire system is open-sourced, with seven benchmark FL datasets, including MNIST, CIFAR10, CIFAR100, FEMNIST, CelebA, Sentiment140, and Shakespeare. The essential components (i.e., dataset, ML models, and FL strategy) can be easily used or self-defined. Thus researchers can implement their new idea and evaluate using FedEval very quickly.
Briefly, three steps are needed to start an experiment in our benchmarking system:
* **Step 1**: Determine the benchmark dataset, ML model, and FL strategy, then modify the data, model, and runtime configs based on the templates.
* **Step 2**: Use the built-in tool to generate data for clients and create the docker-compose files.
* **Step 3**: Start the experiments using docker-compose, and monitor the dashboard for the evaluation status and results.
---
# 3. Tutorial — FedEval documentation
* [](https://fedeval.readthedocs.io/en/latest/index.html)
* 3\. Tutorial
* [Edit on GitHub](https://github.com/Di-Chai/FedEval/blob/master/docs/tutorial/index.rst)
* * *
3\. Tutorial[](https://fedeval.readthedocs.io/en/latest/tutorial/index.html#tutorial "Link to this heading")
==============================================================================================================
* [3.1. Quick Start (single experiment using terminal)](https://fedeval.readthedocs.io/en/latest/tutorial/QuickStart.html)
* [3.1.1. Generate the data and docker-compose file](https://fedeval.readthedocs.io/en/latest/tutorial/QuickStart.html#generate-the-data-and-docker-compose-file)
* [3.1.2. Start the Experiment](https://fedeval.readthedocs.io/en/latest/tutorial/QuickStart.html#start-the-experiment)
* [3.1.3. View the results](https://fedeval.readthedocs.io/en/latest/tutorial/QuickStart.html#view-the-results)
* [3.1.4. Stop the Experiment](https://fedeval.readthedocs.io/en/latest/tutorial/QuickStart.html#stop-the-experiment)
* [3.1.5. Dashboard Example](https://fedeval.readthedocs.io/en/latest/tutorial/QuickStart.html#dashboard-example)
* [3.2. Running Multiple Experiments (using scripts)](https://fedeval.readthedocs.io/en/latest/tutorial/Procedures.html)
* [3.2.1. Start the experiments](https://fedeval.readthedocs.io/en/latest/tutorial/Procedures.html#start-the-experiments)
* [3.2.2. Check the results](https://fedeval.readthedocs.io/en/latest/tutorial/Procedures.html#check-the-results)
* [3.3. Get to know the three configurations](https://fedeval.readthedocs.io/en/latest/tutorial/Configurations.html)
* [3.3.1. Data Config](https://fedeval.readthedocs.io/en/latest/tutorial/Configurations.html#data-config)
* [3.3.2. Model Config](https://fedeval.readthedocs.io/en/latest/tutorial/Configurations.html#model-config)
* [3.3.3. Runtime Config](https://fedeval.readthedocs.io/en/latest/tutorial/Configurations.html#runtime-config)
* [3.3.4. Access Configuraitons Anywhere & Anytime](https://fedeval.readthedocs.io/en/latest/tutorial/Configurations.html#access-configuraitons-anywhere-anytime)
* [3.3.5. Want to Modify the Configuration Scheme?](https://fedeval.readthedocs.io/en/latest/tutorial/Configurations.html#want-to-modify-the-configuration-scheme)
* [3.4. Get to know the FedEval.run and FedEval.run\_util](https://fedeval.readthedocs.io/en/latest/tutorial/RunUtils.html)
* [3.4.1. FedEval.run.\_\_main\_\_](https://fedeval.readthedocs.io/en/latest/tutorial/RunUtils.html#fedeval-run-main)
* [3.4.2. FedEval.run\_util.run](https://fedeval.readthedocs.io/en/latest/tutorial/RunUtils.html#fedeval-run-util-run)
* [3.5. Customization](https://fedeval.readthedocs.io/en/latest/tutorial/Contribute.html)
* [3.5.1. Customize the dataset](https://fedeval.readthedocs.io/en/latest/tutorial/Contribute.html#customize-the-dataset)
* [3.5.2. Customize the ML model](https://fedeval.readthedocs.io/en/latest/tutorial/Contribute.html#customize-the-ml-model)
* [3.5.3. Customize the FL strategies](https://fedeval.readthedocs.io/en/latest/tutorial/Contribute.html#customize-the-fl-strategies)
* [3.6. Interface of FL Algorithms](https://fedeval.readthedocs.io/en/latest/tutorial/StrategyAndCallbacks.html)
* [3.7. Interface of Callback Functions](https://fedeval.readthedocs.io/en/latest/tutorial/StrategyAndCallbacks.html#interface-of-callback-functions)
---
# 2. Environment — FedEval documentation
* [](https://fedeval.readthedocs.io/en/latest/index.html)
* 2\. Environment
* [Edit on GitHub](https://github.com/Di-Chai/FedEval/blob/master/docs/Environment.md)
* * *
2\. Environment[](https://fedeval.readthedocs.io/en/latest/Environment.html#environment "Link to this heading")
=================================================================================================================
In this section, we will help you building the environment.
2.1. Software Dependencies[](https://fedeval.readthedocs.io/en/latest/Environment.html#software-dependencies "Link to this heading")
--------------------------------------------------------------------------------------------------------------------------------------
### 2.1.1. System Requirements[](https://fedeval.readthedocs.io/en/latest/Environment.html#system-requirements "Link to this heading")
Currently, this system only support **Linux** platforms.
Recommended memory sizes for different dataset and models are shown in the following table. Increasing the swap space is a good solution if your compute does not have enough memory.
| Dataset | ML Model | Required RAM size |
| --- | --- | --- |
| MNIST | MLP | 32 GB / 100 Clients |
| MNIST | LeNet | 80 GB / 100 Clients |
| FEMNIST | LeNet | 60 GB / 100 Clients |
| CelebA | LeNet | 128 GB / 100 Clients |
| Sent140 | LSTM | 128 GB / 100 Clients |
### 2.1.2. Docker & Docker Compose (without sudo)[](https://fedeval.readthedocs.io/en/latest/Environment.html#docker-docker-compose-without-sudo "Link to this heading")
[Docker](https://www.docker.com/)
is an indispensable component to virtualize the software and network environment in order to isolate each instance. Follow these [instructions](https://docs.docker.com/engine/install/)
to install Docker on your machine. Follow the guideline on [Link](https://docs.docker.com/engine/install/linux-postinstall/#manage-docker-as-a-non-root-user)
to manage docker as non-root user. Docker has been successfully installed if you got a similar output like this:
$ docker \--version
Docker version 20.10.2, build 2291f61
[Docker Compose](https://docs.docker.com/compose/)
is a tool aimed at easing multi-container operations. Install it under the [guidance](https://docs.docker.com/compose/install/)
and check it with:
$ docker-compose version
docker-compose version 1.27.4, build 40524192
docker-py version: 4.3.1
CPython version: 3.7.4
OpenSSL version: OpenSSL 1.1.1c 28 May 2019
### 2.1.3. Python[](https://fedeval.readthedocs.io/en/latest/Environment.html#python "Link to this heading")
Though most of the programs can be boosted inside containers, it is still recommended to have a Python interpreter installed on your machine for the convenience and immediacy of type checking, auto complete, and so on during code profiling or some advanced, self-defined operations.
For the sake of compatibility with main components of the system, the version of the interpreter should be in the range of 3.5–3.8 currently. You can find how to install them [here](https://www.python.org/downloads/)
.
### 2.1.4. Git (Optional)[](https://fedeval.readthedocs.io/en/latest/Environment.html#git-optional "Link to this heading")
[Git](https://git-scm.com/)
is a distributed version control system. We use it and host this project on [Github](https://github.com/Di-Chai/FedEval)
. Feel free to skip this because you also can download the project as a zip file from the web page.
Clone the project from Github in this way if have installed git.
$ git clone https://github.com/Di-Chai/FedEval.git \-b dev-0.1
2.2. Build the Docker Image[](https://fedeval.readthedocs.io/en/latest/Environment.html#build-the-docker-image "Link to this heading")
----------------------------------------------------------------------------------------------------------------------------------------
The image we build will be used by each instance (both server and clients).
First, clone the project from GitHub:
git clone https://github.com/Di-Chai/FedEval.git
Enter the project directory and build the image.
cd docker
sudo docker build . \-t fedeval:v1
Check image status. This command will list all docker images on your machine.
sudo docker image ls
And you’ll got something like these if nothing goes wrong. It’s okay if the image ID is different.
REPOSITORY TAG IMAGE ID CREATED SIZE
fedeval v1 2386be014ab5 3 months ago 4.39GB
2.3. Download the dataset[](https://fedeval.readthedocs.io/en/latest/Environment.html#download-the-dataset "Link to this heading")
------------------------------------------------------------------------------------------------------------------------------------
The dataset is available at : [resources](https://www.jianguoyun.com/p/DZ8I2q8QhdfRChiDntUEIAA)
Download the `data.tar.gz`, and put it at the project directory. Using the following commend to unpack the data:
mv data.tar.gz FedEval
cd FedEval
tar \-zxvf data.tar.gz
---
# 4. Benchmarks — FedEval documentation
* [](https://fedeval.readthedocs.io/en/latest/index.html)
* 4\. Benchmarks
* [Edit on GitHub](https://github.com/Di-Chai/FedEval/blob/master/docs/benchmark/benchmark.md)
* * *
4\. Benchmarks[](https://fedeval.readthedocs.io/en/latest/benchmark/benchmark.html#benchmarks "Link to this heading")
=======================================================================================================================
4.1. Experiment Settings[](https://fedeval.readthedocs.io/en/latest/benchmark/benchmark.html#experiment-settings "Link to this heading")
------------------------------------------------------------------------------------------------------------------------------------------
### 4.1.1. Algorithms[](https://fedeval.readthedocs.io/en/latest/benchmark/benchmark.html#algorithms "Link to this heading")
We have chosen the following five FL mechanisms which target different issues in the benchmarking:
* [FedSGD](https://proceedings.mlr.press/v54/mcmahan17a/mcmahan17a.pdf)
: FedSGD inherits the settings of large-batch synchronous SGD in data centers, and it is one of the most fundamental FL mechanisms.
* [FedAvg](https://proceedings.mlr.press/v54/mcmahan17a/mcmahan17a.pdf)
: FedAvg is a communication-efficient algorithm aggregating the parameters trained by multiple rounds of clients’ local training.
* [FedProx](https://proceedings.mlsys.org/paper/2020/file/38af86134b65d0f10fe33d30dd76442e-Paper.pdf)
: FedProx targets the non-IID data problem and tries to improve the FedAvg using a regularization on the distance between the global and local models. We fix the regularization’s weight to 0.01 in the benchmark.
* [FedOpt](https://openreview.net/pdf?id=LkFG3lB13U5)
: FedOpt proposed to use the adoptive optimization methods in FL. Three optimizations, including FedAdagrad, FedYogi, and FedAdam, are proposed. And we chose FedAdam in this paper’s benchmarking study.
### 4.1.2. Datasets[](https://fedeval.readthedocs.io/en/latest/benchmark/benchmark.html#datasets "Link to this heading")
We have used five datasets in the experiments: MNIST, FEMNIST, CelebA, Sentiment140, and Shakespeare. One difference between the evaluation datasets used by FL and conventional machine learning is that the data samples are grouped by clients in FL. In our benchmarks, apart from the MNIST, all datasets contain the meta information grouping data samples according to the clients, _e.g._, the photos taken from the same celebrity are grouped together in CelebA, the words spoken by the same character are grouped together in Shakespeare. Most of the datasets contain a large number of clients, _e.g._, the Sentiment140 contains over 50,579 clients, which brings large efficiency overhead during the evaluation and requires significant computing resources, _e.g._, a cluster with 68 GPUs is used to emulate 1300 clients in existing work. To reduce the required sources and standardize the evaluation, we cut the datasets into different scales based on the number of clients and the number of train samples, including small, medium, large, and very large, which are presented in the following table:
| Datasets | Small | Medium | Large | Very Large |
| --- | --- | --- | --- | --- |
| MNIST | 100 #C
300 #S
42.8% | 100 #C
700 #S
100% | \\ | \\ |
| FEMNIST | 100 #C
237 #S
3% | 1000 #C
227 #S
28.6% | 3500 #C
226 #S
100% | \\ |
| CelebA | 100 #C
30 #S
1.5% | 1000 #C
30 #S
14.8% | 9343 #S
22 #S
100% | \\ |
| Sent140 | 100 #C
169#S
2.7% | 1000 #C
78#S
12.3% | 10000 #C
29 #S
45.8% | 50579 #C
13 #S
100% |
| Shakespeare | \\ | 100 #C
489668 #S
11.6% | 1121 #C
4226158 #S
100% | \\ |
(_Table Caption: Accelerate and standardize the evaluation by cutting the datasets into different scales. The information reported in the table is organized by: the number of clients (#C), the number of samples per client (#S), and the ratio of samples held by existing clients to the whole dataset._)
We use the median-scale datasets in all the experiments. Following the notation from previous work, we use \\(B\\), \\(C\\), and \\(E\\) to represent the clients’ local batch size, the ratio of selected clients for training and the clients’ local training passes. We set \\(B=\\infty, C=1.0\\), and \\(E=1\\) for FedSGD on all datasets, and set \\(B=128,C=0.1,E=10\\) for the other methods on all datasets, except for \\(B=1024\\) on the Shakespeare dataset since it has a significant amount of training samples. Then we perform a fine-grained parameter tuning on the learning rate for each FL algorithm on each dataset, starting from 0.0001 to 3.
For datasets that are not collected in FL style (_i.e._, MNIST), we simulate the non-IID data by restricting the number of clients’ local image classes. For example, the experimental results of clients having 1 class of MNIST images are reported in the robustness benchmarks. For datasets collected in the FL manner (_i.e._, the samples are grouped by who generated them), we partition the data naturally based on the identity and randomly shuffle the data between clients to create an ideal IID data setting. To make the comparison close to the real-world setting, we use the non-IID data setting by default and only present the IID data results in the robustness evaluation.
### 4.1.3. Hardware[](https://fedeval.readthedocs.io/en/latest/benchmark/benchmark.html#hardware "Link to this heading")
All the experiments run on a Linux server with Ubuntu 18.04 installed, Intel(R) i7-9700KF 8-core 3.7GHz CPU, 128GB RAM, 960G SSD storage. The hardware platform has 2 GPUs, however, we only use GPUs in the parameter tuning and use CPU for efficiency evaluation since most of the edge devices have no power GPUs. The containers are connected using the docker network using the bridge mode. In the efficiency evaluation, we config FedEval to limit each client can only use 1 CPU core and have a maximum of 8 clients running simultaneously since our CPU only has 8 cores, and we report the federated time consumption as the time evaluation results, which is introduced in our paper.
4.2. Radar Chart[](https://fedeval.readthedocs.io/en/latest/benchmark/benchmark.html#radar-chart "Link to this heading")
--------------------------------------------------------------------------------------------------------------------------

We have attempted to merge different evaluation measures into one radar chart for easy comparison. The challenge lies in quantifying different goals with disparate units and scales into a common range reasonably. We introduce the radar chart computation details next. Notably, the radar charts and computation method here represent our initial attempt; we will continue refining the charts in the future.
**Efficiency score (quantitative):** The efficiency score is the calculated through averaging the quantitative score of three sub-metrics, which are the communication rounds, communication amount, and the time consumption. For each of these sub-metrics, we choose one baseline model (_i.e._, FedSGD), score 1 point to the baseline model, and then compute the score of other methods through comparing to the baseline model. Specifically:
* If the method A’s performance \\(P\_a\\) (_e.g._, time consumption) is worse than the baseline model \\(P\_b\\), then we give score \\(e^{1-P\_b/P\_a}\\) to A.
* Otherwise, if method A’s performance \\(P\_a\\) is better than the baseline model \\(P\_b\\), denoting the best performance as \\(\\bar{P}\\), then we give score \\(1 + 4(P\_b - P\_a)/(P\_b - \\bar{P})\\) to A. We set the best performance \\(\\bar{P}=0\\) for time consumption, \\(\\bar{P}=1\\) for communication rounds, and \\(\\bar{P}=0\\) for communication amount.
**Robustness score (quantitative):**
* Add \\(3\\) points if the non-IID performance disparity to IID model \\(\\le 1\\%\\).
* Add \\(2\\) points if the non-IID performance disparity to IID model \\(\\le 3\\%\\).
* Add \\(1\\) points if the non-IID performance disparity to IID model \\(\\le 5\\%\\).
* Add \\(1\\) point if the stragglers are handled.
* Add \\(1\\) point if the dropouts are handled.
**Effectiveness score (quantitative):**
* If the model’s performance is better than the local model, we score according to the performance disparity to the central model. Score \\(5 \\sim 1\\) if performance disparity to the central model is \\(\\le 1\\%\\), \\(\\le 3\\%\\), \\(\\le 5\\%\\), \\(\\le 10\\%\\), and \\(\\le 20\\%\\), respectively.
* Score \\(0\\) if the performance is worse or equal to local model.
**Security & Privacy score (qualitative):**
For the privacy and security score, we temporarily use the qualitative score in the radar chart and will update the charts as well as the computation methods when more attack experiments are conducted. Briefly, we categorize the ability to defend against privacy and security attacks into different levels based on the amount of information transmitted between the server and clients.
For the ability to resist the privacy attack on the client side (if the clients send less information to the server, they have a stronger ability to defend against the data privacy attacks):
* Score \\(0\\) if directly exchanging raw data.
* Score \\(1\\) if the exchanged parameters are in plaintext and calculated from a single round of training.
* Score \\(2\\) if the exchanged parameters are in plaintext and calculated from multiple rounds of training.
* Score \\(3\\) if the exchanged parameters are protected by DP or the parameters are compressed.
* Score \\(4\\) if the exchanged parameters are protected by secure aggregation.
* Score \\(5\\) if the exchanged parameters are protected by homomorphic encryption.
For the ability to resist the model security attack on the server side (if the server receives more information, it has a stronger ability to defend against the model security attacks):
* Score \\(5\\) if directly exchanging raw data, since the server can always make sure the model is training on the real dataset.
* Score \\(4\\) if the exchanged parameters are in plaintext and calculated from a single round of training.
* Score \\(3\\) if the exchanged parameters are in plaintext and calculated from multiple rounds of training.
* Score \\(2\\) if the exchanged parameters are protected by DP or the parameters are compressed.
* Score \\(1\\) if the exchanged parameters are protected by secure aggregation.
* Score \\(0\\) if the exchanged parameters are protected by homomorphic encryption.
---
# 3.1. Quick Start (single experiment using terminal) — FedEval documentation
* [](https://fedeval.readthedocs.io/en/latest/index.html)
* [3\. Tutorial](https://fedeval.readthedocs.io/en/latest/tutorial/index.html)
* 3.1. Quick Start (single experiment using terminal)
* [Edit on GitHub](https://github.com/Di-Chai/FedEval/blob/master/docs/tutorial/QuickStart.md)
* * *
3.1. Quick Start (single experiment using terminal)[](https://fedeval.readthedocs.io/en/latest/tutorial/QuickStart.html#quick-start-single-experiment-using-terminal "Link to this heading")
==============================================================================================================================================================================================
In this page, we will show how to start an experiment locally using the config fils in QucikStart dir. Please clone the project from Github, open a terminal from the project path and follow the next tutorial.
3.1.1. Generate the data and docker-compose file[](https://fedeval.readthedocs.io/en/latest/tutorial/QuickStart.html#generate-the-data-and-docker-compose-file "Link to this heading")
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Generate the data for all the clients
docker run \-it \--rm \-v $(pwd):$(pwd) \-w $(pwd) fedeval:v1 python \-W ignore \-m FedEval.run \-c configs/quickstart \-f data
Generate the docker-compose file
docker run \-it \--rm \-v $(pwd):$(pwd) \-w $(pwd) fedeval:v1 python \-W ignore \-m FedEval.run \-c configs/quickstart \-f compose-local
3.1.2. Start the Experiment[](https://fedeval.readthedocs.io/en/latest/tutorial/QuickStart.html#start-the-experiment "Link to this heading")
----------------------------------------------------------------------------------------------------------------------------------------------
docker-compose up \-d
3.1.3. View the results[](https://fedeval.readthedocs.io/en/latest/tutorial/QuickStart.html#view-the-results "Link to this heading")
--------------------------------------------------------------------------------------------------------------------------------------
Go to http://127.0.0.1:port/dashboard to see the results. Please change the port according to your config. More detail about the config could be found in [Configs](https://fedeval.readthedocs.io/en/latest/tutorial/QuickStart.html#Configs.html#runtime-config)
.
Here’s an example of the [dashboard](https://fedeval.readthedocs.io/en/latest/tutorial/QuickStart.html#dashboard-example)
.
3.1.4. Stop the Experiment[](https://fedeval.readthedocs.io/en/latest/tutorial/QuickStart.html#stop-the-experiment "Link to this heading")
--------------------------------------------------------------------------------------------------------------------------------------------
Stop and remove the containers using docker-compose (suggested)
docker-compose stop
docker-compose rm
Force stop and remove all the containers
docker stop $(docker ps \--filter ancestor\=fedeval:v1 \-aq)
docker rm $(docker ps \--filter ancestor\=fedeval:v1 \-aq)
3.1.5. Dashboard Example[](https://fedeval.readthedocs.io/en/latest/tutorial/QuickStart.html#dashboard-example "Link to this heading")
----------------------------------------------------------------------------------------------------------------------------------------

* * *
---
# 3.3. Get to know the three configurations — FedEval documentation
* [](https://fedeval.readthedocs.io/en/latest/index.html)
* [3\. Tutorial](https://fedeval.readthedocs.io/en/latest/tutorial/index.html)
* 3.3. Get to know the three configurations
* [Edit on GitHub](https://github.com/Di-Chai/FedEval/blob/master/docs/tutorial/Configurations.md)
* * *
3.3. Get to know the three configurations[](https://fedeval.readthedocs.io/en/latest/tutorial/Configurations.html#get-to-know-the-three-configurations "Link to this heading")
================================================================================================================================================================================
3.3.1. Data Config[](https://fedeval.readthedocs.io/en/latest/tutorial/Configurations.html#data-config "Link to this heading")
--------------------------------------------------------------------------------------------------------------------------------
data\_dir: data
dataset: mnist
non-iid: 0
non-iid-class: 1 \# Only work when non-iid = True
non-iid-strategy: average
normalize: true
sample\_size: 300
shared\_data: 0
train\_val\_test:
\- 0.8
\- 0.1
\- 0.1
| Config Name | Description |
| --- | --- |
| data\_dir | The output directory of the clients' data |
| dataset | Dataset name, mnist / cifar10 / cifar100 / femnist / mnist |
| non-iid | Bool. |
| non-iid-class | The number of image classes hold by each client when non-iid is True |
| non-iid-strategy | "natural" strategy for femnist and celebA dataset
"average" for mnist, cifar10 and cifar100
"gaussian" TODO |
| normalize | Bool. If true, normalize the image to 0~1 |
| sample\_size | Number of Images hold by each client |
| shared\_data | If shared\_data > 0, the system will choose the corresponding number of image from each client to build shard dataset for all the participants |
| train\_val\_test | Split the data to train, validation, and test. This list indicates the shares of each one |
3.3.2. Model Config[](https://fedeval.readthedocs.io/en/latest/tutorial/Configurations.html#model-config "Link to this heading")
----------------------------------------------------------------------------------------------------------------------------------
FedModel:
name: FedSGD
\# Shared params
B: 1000
C: 1.0
E: 1
max\_rounds: 1000
num\_tolerance: 100
rounds\_between\_val: 1
\# FedSTC
sparsity: 0.01
\# FedProx
mu: 0.01
\# FedOpt
tau: 0.0001
beta1: 0.9
beta2: 0.99
opt\_name: 'fedyogi'
\# Server LR, used by FedOpt and FedSCA
eta: 1.0
MLModel:
name: MLP
activation: relu
dropout: 0.2
units:
\- 512
\- 512
optimizer:
name: sgd
lr: 0.1
momentum: 0
loss: categorical\_crossentropy
metrics:
\- accuracy
Three models are placed inside the system: MLP, LeNet, and MobileNet. You can add your own model and put the config in this file.
### 3.3.2.1. FedModel[](https://fedeval.readthedocs.io/en/latest/tutorial/Configurations.html#fedmodel "Link to this heading")
| Config Name | Description |
| --- | --- |
| name | The name of federated strategy |
| num\_tolerance | Early stopping patience |
| max\_rounds | The maximum rounds that can be reached |
| rounds\_between\_val | The number of round between test or validation |
| B | The local minibatch size used for the client updates |
| C | The fraction of clients that perform computation on each round |
| E | The number of training passes each client makes over its local dataset on each round |
Strategy-specific configuraitons:
| Federated Strategy | Config Name | Description |
| --- | --- | --- |
| FedSTC | sparsity | |
| FedProx | mu | the /mu parameter in FedProx, a scaler that measures the approximation between the local model and the global model. |
| FedOpt | tau | TBD |
| FedOpt | beta1 | TBD |
| FedOpt | beta2 | TBD |
| FedOpt | opt\_name | TBD |
| FedSCA/FedOpt | eta | the learning rate on the server side. |
| FetchSGD | num\_col | the number of columns in FetchSGD. TODO(fgh) more specific |
| FetchSGD | num\_row | the number of rows in FetchSGD. |
| FetchSGD | num\_block | the number of blocks in FetchSGD. |
| FetchSGD | top\_k | the number of top items during the TopK unsketching. |
### 3.3.2.2. MLModel[](https://fedeval.readthedocs.io/en/latest/tutorial/Configurations.html#mlmodel "Link to this heading")
All configuraitons of the machine learning model is available in [TensorFlow Core v2 APIs](https://tensorflow.google.cn/api_docs/python/tf)
, for the code in the model module is conducted with tensorflow-v2.
To be done.
3.3.3. Runtime Config[](https://fedeval.readthedocs.io/en/latest/tutorial/Configurations.html#runtime-config "Link to this heading")
--------------------------------------------------------------------------------------------------------------------------------------
clients:
bandwidth: 100Mbit
docker:
image: fedeval:v4
server:
host: server
listen: server
num\_clients: 10
port: 8080
log\_dir: log/quickstart
The runtime config contains the parameters that will be used in the FL training, and it contains two parts: the client and server.
| Config Name | Description |
| --- | --- |
| bandwidth | Bandwidth for the clients in the uploading and downloading
We do not restrict the bandwidth for the server. |
| num\_clients | The number of clients |
| docker image | The docker image that will be used for both client and server. |
| host | The IP address that clients connect to the server, could be set to host-name or 'server' (the name of the container network) |
| listen | The listen address for the server, could be set to 0.0.0.0 or 'server' (the name of the container network) |
| port | Port, e.g., 8080 |
| log\_dir | Path for saving the log and results |
3.3.4. Access Configuraitons Anywhere & Anytime[](https://fedeval.readthedocs.io/en/latest/tutorial/Configurations.html#access-configuraitons-anywhere-anytime "Link to this heading")
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Once the `ConfigurationManager` is directly constructed with `RawConfigurationDict`s or deserialized from some medium representations (e.g., JSON and YAML within string or file system), it can not be modified any more. While there are some exceptions:
1. the filename of the configurations: these are used to (de)serialize the configuraitons during runtime.
2. the role of an instance: the role of an instance should be set as soon as the role of the instance is clear for once and only once. Currently, the role is set during the construction of Server/Client in the `role` module.
3. encoding: the encoding for the (de)serialization operations.
It is highly recommend to have `ConfigurationManager` constructed(or, initialized) once all the modifications on the `RawConfigurationDict` were done. You can initialize it as follows:
from ..config.configuration import ConfigurationManager
\# 1. constructed from raw config dicts
\# ... read configuration dicts ...
ConfigurationManager(data\_config, model\_config, runtime\_config)
\# 2. deserialized from file (for example here, from\_yamls and from\_jsons are also available.)
cfg\_mgr \= ConfigurationManager.from\_files(data\_cfg\_path, model\_cfg\_path, runtime\_cfg\_path)
Currently, the initialization of the `ConfigurationManager` is conducted in run.py and run\_util.py.
After the initialization, you can access all the configurations from anywhere and at anytime.
from ..config.configuration import ConfigurationManager
cfg\_mgr \= ConfigurationManager()
d\_cfg, mdl\_cfg, rt\_cfg \= cfg\_mgr.data\_config, cfg\_mgr.model\_config, cfg\_mgr.runtime\_config
Noticed that all the configigurations have been reorganized as objects, thus you can access any items in the configurations just like accessing attributes of an object, with concrete type hints and type conversion:
d\_name: str \= d\_cfg.dataset\_name
You cannot set the attributes with a new value, for the setters of these properties are not implemented for security considerations. You will get an `AttributeError` if you assigned it with a new value.
3.3.5. Want to Modify the Configuration Scheme?[](https://fedeval.readthedocs.io/en/latest/tutorial/Configurations.html#want-to-modify-the-configuration-scheme "Link to this heading")
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Go ahead into `config` module. More specifically, into ‘config/configuration.py’, where all the preset configuration schemes are defined. At least two steps are required to add a new configuration item:
1. define the key name in the dict;
2. (optional but recommended) give a default value of this new item;
3. add a new property in the corresponding `_Config` class.
Now, we take ‘dataset’ in ‘1\_data\_config.yml’ as an example for illustration. First, let’s define its key name in the dict.
\# others are omitted
\_D\_NAME\_KEY \= 'dataset' \# here!
\_DEFAULT\_D\_CFG: RawConfigurationDict \= {
\_D\_NAME\_KEY: 'mnist', \# and give it a default value
\# others are omitted
}
Then, add a property in `_DataConfig`.
class \_DataConfig(\_Configuraiton):
@property
def dataset\_name(self) \-> str:
return self.\_inner\[\_D\_NAME\_KEY\]
Now, you can configure the name of dataset in the configuration files and access it in the code.
---
# 3.2. Running Multiple Experiments (using scripts) — FedEval documentation
* [](https://fedeval.readthedocs.io/en/latest/index.html)
* [3\. Tutorial](https://fedeval.readthedocs.io/en/latest/tutorial/index.html)
* 3.2. Running Multiple Experiments (using scripts)
* [Edit on GitHub](https://github.com/Di-Chai/FedEval/blob/master/docs/tutorial/Procedures.md)
* * *
3.2. Running Multiple Experiments (using scripts)[](https://fedeval.readthedocs.io/en/latest/tutorial/Procedures.html#running-multiple-experiments-using-scripts "Link to this heading")
==========================================================================================================================================================================================
3.2.1. Start the experiments[](https://fedeval.readthedocs.io/en/latest/tutorial/Procedures.html#start-the-experiments "Link to this heading")
------------------------------------------------------------------------------------------------------------------------------------------------
In the last section (QuickStart), we presented how to start a single experiment at the terminal. Although we can start different trials by modifying the parameters in the config file, the terminal way of starting the experiments is not convenient.
Thus, we introduce a new way to run multiple experiments using the scripts.
Briefly, we use the `FedEval.run_util.run` function, which is a higher-level scheduler based on `FedEval.run`, ssh and scp. Specifically, it direct the whole lifecycle of each instances in an experiment, including:
1. compose and dispatch the dockerfile and configuration files;
2. prepare the dataset for each client;
3. launch the experiments;
4. stop the experiment at any time you want.
Here’s an example which aimed at conducting a grid search for learning rate `lr`.
from FedEval.run\_util import run
params \= {
'data\_config': {
'dataset': 'mnist',
'non-iid': False,
'sample\_size': 300,
},
'model\_config': {
'MLModel': {
'name': 'MLP',
'optimizer': {
'name': 'sgd', 'lr': 0.5, 'momentum': 0
}
},
'FedModel': {
'name': 'FedAvg', 'B': 16, 'C': 0.1, 'E': 10,
'max\_rounds': 3000, 'num\_tolerance': 100,
}
},
'runtime\_config': {
'server': {
'num\_clients': 10
}
}
}
config \= 'configs/quickstart'
for lr in \[0.001, 0.01, 0.1, 1\]:
\# update learning rate in configuration
params\['model\_config'\]\['MLModel'\]\['optimizer'\]\['lr'\] \= lr
run(execution\='run', mode\='local', config\=config, new\_config\=config + '\_tmp', \*\*params)
Noted that the `params` passed into `run` will override the configurations specified in `config='configs/quickstart'`. And the new configurations will be saved to `new_config=config + '_tmp'`, i.e., keeping the original file untouched.
3.2.2. Check the results[](https://fedeval.readthedocs.io/en/latest/tutorial/Procedures.html#check-the-results "Link to this heading")
----------------------------------------------------------------------------------------------------------------------------------------
Logs, results and model weight records are stored under `log` directory, classified by their names and time when they run the experiments.
Using the following commend to collect the results from the logs:
docker run \-it \--rm \-v $(pwd):$(pwd) \-w $(pwd) fedeval:v1 python \-W ignore \-m FedEval.run\_util \-e log \-p log/quickstart/Server
---
# 3.4. Get to know the FedEval.run and FedEval.run_util — FedEval documentation
* [](https://fedeval.readthedocs.io/en/latest/index.html)
* [3\. Tutorial](https://fedeval.readthedocs.io/en/latest/tutorial/index.html)
* 3.4. Get to know the FedEval.run and FedEval.run\_util
* [Edit on GitHub](https://github.com/Di-Chai/FedEval/blob/master/docs/tutorial/RunUtils.md)
* * *
3.4. Get to know the FedEval.run and FedEval.run\_util[](https://fedeval.readthedocs.io/en/latest/tutorial/RunUtils.html#get-to-know-the-fedeval-run-and-fedeval-run-util "Link to this heading")
===================================================================================================================================================================================================
3.4.1. FedEval.run.\_\_main\_\_[](https://fedeval.readthedocs.io/en/latest/tutorial/RunUtils.html#fedeval-run-main "Link to this heading")
--------------------------------------------------------------------------------------------------------------------------------------------
This function is a CLI interface, which is used to:
* prepare dataset according to 1\_data\_config.yml;
* compose dockerfile for both local and server(remote) mode;
* launch a single experiment;
`FedEval.run.__main__` is suitable for _small scale_ experiments, such as prototype iteration, debug. You can directly use them in containers like this:

where the dark part issues a new container using the image we build (tagged as fedeval:v4); the blue part are parameters of `docker run` command, which maps the current directory to the same place in the container and sets working directory as this one; the red part is what we run in the container; and the orange part are parameters of `FedEval.run.__main__`.
Here’s an example to launch a local experiment with the preset configurations in `FedEval/configs/quickstart`.
1. Preprocess the dataset:
`sudo docker run -it --rm -v $(pwd):$(pwd) -w $(pwd) fedeval:v4 python -m FedEval.run -c configs/quickstart -f data`
2. Generate the local compose-file:
`sudo docker run -it --rm -v $(pwd):$(pwd) -w $(pwd) fedeval:v4 python -m FedEval.run -c configs/quickstart -f compose-local`
3. Start the experiment as a daemon (remove `-d` if you want to see logs from terminal):
`sudo docker-compose up -d`
4. After a few seconds, visit `http://127.0.0.1:8080/dashboard` on your browser to have an overview of the experiment’s status.
For full details about this function, please refer to the [documentation](https://fedeval.readthedocs.io/en/latest/tutorial/RunUtils.html#)
.
3.4.2. FedEval.run\_util.run[](https://fedeval.readthedocs.io/en/latest/tutorial/RunUtils.html#fedeval-run-util-run "Link to this heading")
---------------------------------------------------------------------------------------------------------------------------------------------
This function is a higher-level scheduler based on `FedEval.run`, ssh and scp. Specifically, it direct the whole lifecycle of each instances in an experiment, including:
1. compose and dispatch dockerfile and configuration files;
2. prepare the dataset for each client;
3. launch train-val-test iterations;
4. stop the experiment at any time you want;
As it is exposed as a function interface, it can be coded in order to handle some large-scale operations, such as grid search, tuning, etc.
Here’s an example which aimed at conducting a grid search for learning rate `lr`.
from FedEval.run\_util import run
params \= {
'data\_config': {
'dataset': 'mnist',
'non-iid': True,
'sample\_size': 300,
'non-iid-class': 2,
'non-iid-strategy': 'average'
},
'model\_config': {
'MLModel': {
'name': 'MLP',
'optimizer': {
'name': 'sgd', 'lr': 0.5, 'momentum': 0
}
},
'FedModel': {
'name': 'FedAvg', 'B': 16, 'C': 0.1, 'E': 10,
'max\_rounds': 3000, 'num\_tolerance': 100,
}
},
'runtime\_config': {
'server': {
'num\_clients': 10
}
}
}
for lr in \[0.001, 0.01, 0.1, 1\]:
params\['model\_config'\]\['MLModel'\]\['optimizer'\]\['lr'\] \= lr \# update learning rate in configuration
run(exec\='run', mode\='local', config\='configs/quickstart', new\_config\=config + '\_tmp', \*\*params)
Noted that the `params` passed into `run` in line 32 will override the configurations specified in `config='configs/quickstart'`. In another word, this interface will take in two configurations: One is saved in external YAML files as a default choice; the other one is an optional parameter of function `FedEval.run_util.run`. And the latter one has a higher priority.
After run this script in terminal, you can visit `http://127.0.0.1:8080/dashboard` have an overview of the experiments’ status.
---
# 3.6. Interface of FL Algorithms — FedEval documentation
* [](https://fedeval.readthedocs.io/en/latest/index.html)
* [3\. Tutorial](https://fedeval.readthedocs.io/en/latest/tutorial/index.html)
* 3.6. Interface of FL Algorithms
* [Edit on GitHub](https://github.com/Di-Chai/FedEval/blob/master/docs/tutorial/StrategyAndCallbacks.md)
* * *
3.6. Interface of FL Algorithms[](https://fedeval.readthedocs.io/en/latest/tutorial/StrategyAndCallbacks.html#interface-of-fl-algorithms "Link to this heading")
==================================================================================================================================================================
Our interface of FL algorithm provides the following functions for customizing the host’s behaviors:
* **update\_host\_params**: It takes clients’ uploaded parameters as input, then update and return the host model weights. The default aggregation method is weighted average, and the users could override this function to provide different aggregation methods.
* **retrieve\_host\_download\_info**: It returns the message that the clients download. By default, it returns the host’s model weight, and the users could override this function to customize the data that clients download from the server.
* **host\_select\_train\_clients**: It takes all the ready clients’ identity (CID) as input, then return the CIDs that will participate in the next round of training. By default, it randomly chooses clients according the parameters (\\ie, the ratio of participation), and the users could override this function to change the client selection strategy.
* **host\_select\_eval\_clients**: It takes all the ready clients’ identity (CID) as input, then return the CIDs that will participate in the next round of evaluation. Similar with **host\_select\_train\_clients**, it randomly chooses clients according the parameters by default.
* **host\_exit\_job**: This function will be executed by the host when the federated training finished. By default it does nothing.
Our interface of FL algorithm provides the following functions for customizing the clients’ behaviors:
* **set\_host\_params\_to\_local**: It takes the data downloaded from the host as input, then update the client’s local parameters. By default, it directly set the global parameters into local model, and the users could override this function to customize the approach of setting global parameters to local model.
* **fit\_on\_local\_data**: This function is executed by the clients to update the local parameters using local data. By default, it runs stochastic gradients descent (SGD) using a group of configurable training parameters (e.g., batch size and learning rate) and users could override this function to provide other training methods.
* **retrieve\_local\_upload\_info**: It returns the data that the clients will upload to the host. By default, it returns the local model parameters and users could override this function to customize the clients’ uploaded data, e.g., uploading compressed gradients.
* **local\_evaluate**: This function is executed by the clients to evaluate on local models and return the evaluation results (e.g., accuracy and loss on test data) to the server for making decisions on whether the federated training has converged. The users could override this function to customize the evaluation targets.
* **client\_exit\_job**: This function is executed by the clients after the federated training finished. By default, it does nothing and the users could override this function to customize behaviors of the clients after the training, e.g., fine tune the model on local datasets to get better personalization and perform another round of evaluation.
The following figure shows the serialized workow of the host’s and clients’ functions. The users could implement new FL algorithm through overriding one or multiple of these functions.

3.7. Interface of Callback Functions[](https://fedeval.readthedocs.io/en/latest/tutorial/StrategyAndCallbacks.html#interface-of-callback-functions "Link to this heading")
============================================================================================================================================================================
Besides the function for implementing new FL algorithms, we also provide interface of callback functions to make the implementation of attacks and defenses easier. Briefly, we have the following callback functions:
* **on\_client\_train\_begin**: The clients’ data and model parameters pass through this function before training. Users could override this function to perform data poisoning and model poisoning before the training.
* **on\_client\_upload\_begin**: The clients’ uploading parameters pass through this function after the training. Users could override this function to perform model poisoning attack after the training.
* **on\_host\_aggregation\_begin**: The group of clients’ uploaded parameters pass through this function before the aggregation. Users could override this function to perform gradients attacks, inference attacks, and defend the data/model poisoning attacks at the host side, e.g., byzantine-robust aggregation.
* **on\_setting\_host\_to\_local**: The downloaded parameters from the host passes through this function before the client updates the parameters to local model. Users could override this function to defend the data/model poisoning attacks at the client size.
* **on\_host\_exit**: The host’s model weights pass through this function after the training finishes. Users could override this function to perform model inversion attacks.
* **on\_client\_exit**: The client’s model weights and local data pass through this function after the training finishes. Users could override this function to perform model inversion attacks.
Based on these delicately designed interfaces, users could easily implement and evaluate attacks and defenses in FL, including the model/data poisoning attacks and defenses, inference attacks, gradients attacks, and model inversion attacks.
---
# 3.5. Customization — FedEval documentation
* [](https://fedeval.readthedocs.io/en/latest/index.html)
* [3\. Tutorial](https://fedeval.readthedocs.io/en/latest/tutorial/index.html)
* 3.5. Customization
* [Edit on GitHub](https://github.com/Di-Chai/FedEval/blob/master/docs/tutorial/Contribute.md)
* * *
3.5. Customization[](https://fedeval.readthedocs.io/en/latest/tutorial/Contribute.html#customization "Link to this heading")
==============================================================================================================================
3.5.1. Customize the dataset[](https://fedeval.readthedocs.io/en/latest/tutorial/Contribute.html#customize-the-dataset "Link to this heading")
------------------------------------------------------------------------------------------------------------------------------------------------
There are two steps to add a new dataset into FedEval:
**Step 1**: Create a new script in $ProjectPath/FedEval/dataset/ with the following content: inherit the `FedData` class in $ProjectPath/FedEval/dataset/FedDataBase.py, and override the `load_data` function.
**Step 2**: Set the shape information in $ProjectPath/FedEval/dataset/\_\_init\_\_.py
Next we will give a concrete example showing how to add a new dataset through the above two steps.
Assuming we want to add the IMDB emotion classification dataset.
**Step 1 (Example):**
Create the FedIMDB.py file with the following content:
import numpy as np
import tensorflow as tf
from .FedDataBase import FedData
\# Example of using data from tf.keras.datasets
class imdb(FedData):
def load\_data(self):
\# load the data
(x\_train, y\_train), (x\_test, y\_test) \= tf.keras.datasets.imdb.load\_data()
x \= np.concatenate((x\_train, x\_test), axis\=0)
y \= np.concatenate((y\_train, y\_test), axis\=0)
\# data processing (padding to the same length)
fixed\_len \= int(np.median(\[len(e) for e in x\]))
for i in range(len(x)):
if len(x\[i\]) \> fixed\_len:
x\[i\] \= x\[i\]\[\-fixed\_len:\]
else:
x\[i\] \= \[0\] \* (fixed\_len\-len(x\[i\])) + x\[i\]
x \= np.array(list(x))
y \= np.expand\_dims(y, axis\=-1)
\# Set self.num\_class (Required)
\# Currently we only support classification tasks, because the simulation
\# of non-IID data needs the class labels. The non-classification tasks will
\# be supported in the future.
self.num\_class \= y.shape\[\-1\]
"""
Shape of x: \[50000, 176\], i.e., \[#samples, the frature dims\]
Shape of y: \[50000, 1\], i.e., \[#samples, the label dims\]
"""
return x, y
\# Example of using data from arbitary source
class intel(FedData):
def load\_data(self):
\# Step 1 : Put the data in $ProjectPath/FedEval/data
\# For example, the data path is $ProjectPath/FedEval/data/intel\_image\_classification
\# Data used in this example could be downloaded at :
\# https://www.kaggle.com/puneet6060/intel-image-classification/version/2
data\_path \= os.path.join(os.path.dirname(self.local\_path), 'data', 'intel\_image\_classification')
\# By default, we load all images in seg\_train as training data
train\_image\_path \= os.path.join(data\_path, 'seg\_train', 'seg\_train')
image\_labels \= sorted(os.listdir(train\_image\_path))
x \= \[\]
y \= \[\]
for image\_label in image\_labels:
curr\_label \= image\_labels.index(image\_label)
for image\_file in os.listdir(os.path.join(train\_image\_path, image\_label)):
tmp\_image\_data \= cv2.imread(os.path.join(train\_image\_path, image\_label, image\_file))
tmp\_image\_data \= cv2.resize(tmp\_image\_data, (150, 150), interpolation\=cv2.INTER\_AREA)
x.append(tmp\_image\_data)
y.append(curr\_label)
"""
You may add image preprocessing steps here.
"""
\# Formatting the data into np.array
x \= np.array(x).astype(np.float32)
y \= np.expand\_dims(np.array(y).astype(np.int32), \-1)
y \= tf.keras.utils.to\_categorical(y, self.num\_class)
\# Shuffle the data
x, y \= shuffle(x, y)
\# Set self.num\_class (Required)
\# Currently we only support classification tasks, because the simulation
\# of non-IID data needs the class labels. The non-classification tasks will
\# be supported in the future.
self.num\_class \= y.shape\[\-1\]
print(x.shape, y.shape)
return x, y
**Note (For Non-IID dataset)**: The IMDB dataset are not original used for federated learning, thus we do not have the information of who generate the data samples in real-world. If such information is available, e.g., who generate the data for each sample, we can utilize these information by setting value to `self.identity`. For example, in the `load_data(self)` function, we have `self.identity = [10, 9, 10]`, then it means that the dataset is generated by three participants and they have 10, 9, and 10 samples respectively. Apart from setting `self.identity` properly, we need to sort the data samples (i.e., x) and labels (i.e., y) according to the identity, such that the `x[:10],y[:10]` are generated by the first participant in `self.identity`, `x[10:19],y[10:19]` are generated by the second one, and the last 10 samples in `x,y` are generated by the last participant.
**Step 2 (Example):**
Modify the $ProjectPath/FedEval/dataset/\_\_init\_\_.py, such that the new dataset could be used outside.
Two substeps, i.e., 2.1 and 2.2, are required.
from .FedImage import \*
from .Sentiment140 import \*
from .Shakespeare import \*
\# Step 2.1 Add the import information
from .FedIMDB import imdb
\# Used by the server, because it cannot reach the raw data
def get\_data\_shape(dataset):
if dataset \== 'celeba':
x\_size \= (None, 54, 44, 3)
y\_size \= (None, 2)
elif dataset \== 'femnist':
x\_size \= (None, 28, 28, 1)
y\_size \= (None, 62)
elif dataset \== 'mnist':
x\_size \= (None, 28, 28, 1)
y\_size \= (None, 10)
elif dataset \== 'cifar10':
x\_size \= (None, 32, 32, 3)
y\_size \= (None, 10)
elif dataset \== 'cifar100':
x\_size \= (None, 32, 32, 3)
y\_size \= (None, 100)
elif dataset \== 'shakespeare':
x\_size \= (None, 80)
y\_size \= (None, 80)
elif dataset \== 'sentiment140':
x\_size \= (None, 25, 200)
y\_size \= (None, 1)
\# Step 2.2 Add the shape information
elif dataset \== 'imdb': \# the name is the same with the class name, i.e., class imdb(FedData)
x\_size \= (None, 176)
y\_size \= (None, 1)
elif dataset \== 'intel': \# the name is the same with the class name
x\_size \= (None, 150, 150, 3)
y\_size \= (None, 6)
else:
raise ValueError('Unknown dataset', dataset)
return x\_size, y\_size
**Finish:** Now the IMDB and Inter-Image-Classification datasets is available in FedEval by setting `dataset` to `imdb` or `intel` in the data config.
3.5.2. Customize the ML model[](https://fedeval.readthedocs.io/en/latest/tutorial/Contribute.html#customize-the-ml-model "Link to this heading")
--------------------------------------------------------------------------------------------------------------------------------------------------
We build all ML models in FedEval using the subclass method from tensorflow.keras.
Two steps are required to add a customized ML model:
**Step 1:** Create a new script in $ProjectPath/FedEval/model/ with the following content: inherit the `tf.keras.Model` and build your own model.
**Step 2:** Import the model in $ProjectPath/FedEval/model/\_\_init\_\_.py
Next we give a concrete example showing how to add a new ML model in FedEval.
Assume we want to create a MLP with 2 layers, and each layer has 256 hidden units.
**Step 1 (Example):**
Create a new file mlp\_example.py in $ProjectPath/FedEval/model/, and build the model like following:
import functools
import tensorflow as tf
class MLP\_simplify(tf.keras.Model):
def \_\_init\_\_(self, target\_shape, \*\*kwargs):
super().\_\_init\_\_()
num\_classes \= target\_shape\[\-1\]
self.dense1 \= tf.keras.layers.Dense(256)
self.dense2 \= tf.keras.layers.Dense(256)
self.output \= tf.keras.layers.Dense(num\_class, activation\='softmax')
def call(self, inputs, training\=None, mask\=None):
x \= self.dense1(inputs)
x \= self.dense2(x)
x \= self.output(x)
return x
**Step 2 (Example):**
Modify the $ProjectPath/FedEval/model/\_\_init\_\_.py refer the following example:
from .MLP import MLP
from .LeNet import LeNet
from .StackedLSTM import StackedLSTM
\# Step 2 : Import the new model
from .mlp\_example import MLP\_simplify
**Finish:** Now this MLP model is available in FedEval by setting `MLMode/name` to `MLP_simplify` in the model config.
3.5.3. Customize the FL strategies[](https://fedeval.readthedocs.io/en/latest/tutorial/Contribute.html#customize-the-fl-strategies "Link to this heading")
------------------------------------------------------------------------------------------------------------------------------------------------------------
Two steps are required to add a new federated learning strategy:
**Step 1:** Create a new scripts in $ProjectPath/FedEval/strategy/ with the following content: inherit the `FedAvg` class in $ProjectPath/FedEval/strategy/FedAvg.py, and override the functions according to the federated learning strategy.
**Step 2:** Import the strategy in $ProjectPath/FedEval/strategy/\_\_init\_\_.py
Next we will give an example showing how to add FL strategies into FedEval.
**Step 1 (Example)**
Create a new scripts `FedAvg_example.py` in $ProjectPath/FedEval/strategy/, with the following content:
import os
import pickle
import numpy as np
import tensorflow as tf
from ..aggregator import aggregate\_weighted\_average
from ..model import \*
from ..dataset import get\_data\_shape
from ..utils import ParamParser
from .FedAvg import FedAvg
class FedAvg\_example(FedAvg):
def \_\_init\_\_(self, role, data\_config, model\_config, runtime\_config, param\_parser\=ParamParser):
\# By defaullt, the init function will do the following things:
\# (1) initialize the ML model at self.ml\_model
\# (2) load the dataset if current role is client
\# (3) initialize some variables if current role is server, e.g., self.params
super().\_\_init\_\_(role, data\_config, model\_config, runtime\_config)
\# (1) Host functions
def host\_get\_init\_params(self):
"""
This function is used by the server to initialize the params.
The params are randomly initialized in FedAvg.
Update this function if you have a different initiaization method.
Otherwise, this function is not required to override.
"""
self.params \= self.ml\_model.get\_weights()
return self.params
\# (1) Host functions
def update\_host\_params(self, client\_params, aggregate\_weights):
"""
This function is used by the server to update the global params.
The clients' params are weighted averaged in FedAvg.
Update this function if you have a different aggregation method.
Otherwise, this function is not required to override.
"""
self.params \= aggregate\_weighted\_average(client\_params, aggregate\_weights)
return self.params
\# (2) Client functions
def set\_host\_params\_to\_local(self, host\_params, current\_round):
"""
This function is used by the clients to set global model to local.
The global model are directly set to local in FedAvg.
Update this function if you have a different method.
Otherwise, this function is not required to override.
"""
if self.callback is not None:
host\_params \= self.callback.on\_setting\_host\_to\_local(host\_params)
self.current\_round \= current\_round
self.ml\_model.set\_weights(host\_params)
\# (2) Client functions
def fit\_on\_local\_data(self):
"""
This function is used by the clients to train on local data.
Update this function if you have a different method.
Otherwise, this function is not required to override.
"""
if self.callback is not None:
self.train\_data, model \= self.callback.on\_client\_train\_begin(
data\=self.train\_data, model\=self.ml\_model.get\_weights()
)
self.ml\_model.set\_weights(model)
self.local\_params\_pre \= self.ml\_model.get\_weights()
train\_log \= self.ml\_model.fit(
x\=self.train\_data\['x'\], y\=self.train\_data\['y'\],
epochs\=self.model\_config\['FedModel'\]\['E'\],
batch\_size\=self.model\_config\['FedModel'\]\['B'\]
)
train\_loss \= train\_log.history\['loss'\]\[\-1\]
self.local\_params\_cur \= self.ml\_model.get\_weights()
return train\_loss, self.train\_data\_size
\# (2) Client functions
def retrieve\_local\_upload\_info(self):
"""
This function is used by the clients to get the uploading params.
The whole model are uploaded by clients in FedAvg.
Update this function if you have a different uploading solution.
Otherwise, this function is not required to override.
"""
model \= self.ml\_model.get\_weights()
if self.callback is not None:
model \= self.callback.on\_client\_upload\_begin(model)
return model
\# (2) Client functions
def local\_evaluate(self):
"""
This function is used by the clients to evaluate on local data.
Update this function if you have a different uploading solution.
Otherwise, this function is not required to override.
"""
evaluate \= {}
\# val and test
val\_result \= self.ml\_model.evaluate(x\=self.val\_data\['x'\], y\=self.val\_data\['y'\])
test\_result \= self.ml\_model.evaluate(x\=self.test\_data\['x'\], y\=self.test\_data\['y'\])
metrics\_names \= self.ml\_model.metrics\_names
\# Reformat
evaluate.update({'val\_' + metrics\_names\[i\]: float(val\_result\[i\]) for i in range(len(metrics\_names))})
evaluate.update({'test\_' + metrics\_names\[i\]: float(test\_result\[i\]) for i in range(len(metrics\_names))})
\# TMP
evaluate.update({'val\_size': self.val\_data\_size})
evaluate.update({'test\_size': self.test\_data\_size})
return evaluate
**Step 2 (Example)**
Modify the $ProjectPath/FedEval/strategy/\_\_init\_\_.py refer the following example:
from .FedAvg import FedAvg, FedSGD
from .FedSTC import FedSTC
from .FedProx import FedProx
from .FedOpt import FedOpt
from .FedSCA import FedSCA
from .MFedAvg import MFedAvg, MFedSGD
from .LocalCentral import LocalCentral
\# Import the new strategy
from .FedAvg\_example import FedAvg\_example
**Finish:** Now this FedAvg\_example strategy is available in FedEval by setting `FedModel/name` to `FedAvg_example` in the model config.
---
# 5. API Reference — FedEval documentation
* [](https://fedeval.readthedocs.io/en/latest/index.html)
* 5\. API Reference
* [Edit on GitHub](https://github.com/Di-Chai/FedEval/blob/master/docs/autoapi/index.rst)
* * *
5\. API Reference[](https://fedeval.readthedocs.io/en/latest/autoapi/index.html#api-reference "Link to this heading")
=======================================================================================================================
This page contains auto-generated API reference documentation [\[1\]](https://fedeval.readthedocs.io/en/latest/autoapi/index.html#f1)
.
* [5.1. `FedEval`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/index.html)
* [5.1.1.1. `FedEval.aggregator`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/aggregator/index.html)
* [5.1.1.1.1.1. `FedEval.aggregator.ModelWeight`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/aggregator/ModelWeight/index.html)
* [5.1.1.1.1.2. `FedEval.aggregator.bulyan`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/aggregator/bulyan/index.html)
* [5.1.1.1.1.3. `FedEval.aggregator.krum`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/aggregator/krum/index.html)
* [5.1.1.1.1.4. `FedEval.aggregator.mean`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/aggregator/mean/index.html)
* [5.1.1.1.1.5. `FedEval.aggregator.median`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/aggregator/median/index.html)
* [5.1.1.1.1.6. `FedEval.aggregator.norm_clipping`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/aggregator/norm_clipping/index.html)
* [5.1.1.1.1.7. `FedEval.aggregator.trim`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/aggregator/trim/index.html)
* [5.1.1.1.1.8. `FedEval.aggregator.utils`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/aggregator/utils/index.html)
* [5.1.1.2. `FedEval.communicaiton`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/communicaiton/index.html)
* [5.1.1.2.1.1. `FedEval.communicaiton.comm_pb2`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/communicaiton/comm_pb2/index.html)
* [5.1.1.2.1.2. `FedEval.communicaiton.comm_pb2_grpc`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/communicaiton/comm_pb2_grpc/index.html)
* [5.1.1.2.1.3. `FedEval.communicaiton.communicator`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/communicaiton/communicator/index.html)
* [5.1.1.2.1.4. `FedEval.communicaiton.events`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/communicaiton/events/index.html)
* [5.1.1.2.1.5. `FedEval.communicaiton.flask_communicator`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/communicaiton/flask_communicator/index.html)
* [5.1.1.2.1.6. `FedEval.communicaiton.grpc_communicator`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/communicaiton/grpc_communicator/index.html)
* [5.1.1.2.1.7. `FedEval.communicaiton.model_weights_io`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/communicaiton/model_weights_io/index.html)
* [5.1.1.2.1.8. `FedEval.communicaiton.preset`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/communicaiton/preset/index.html)
* [5.1.1.3. `FedEval.config`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/config/index.html)
* [5.1.1.3.1.1. `FedEval.config.configuration`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/config/configuration/index.html)
* [5.1.1.3.1.2. `FedEval.config.filename_checker`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/config/filename_checker/index.html)
* [5.1.1.3.1.3. `FedEval.config.role`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/config/role/index.html)
* [5.1.1.3.1.4. `FedEval.config.service_interface`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/config/service_interface/index.html)
* [5.1.1.3.1.5. `FedEval.config.singleton`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/config/singleton/index.html)
* [5.1.1.3.1.6. `FedEval.config.test_config`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/config/test_config/index.html)
* [5.1.1.3.1.7. `FedEval.config.test_singleton`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/config/test_singleton/index.html)
* [5.1.1.4. `FedEval.dataset`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/dataset/index.html)
* [5.1.1.4.1.1. `FedEval.dataset.CelebA`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/dataset/CelebA/index.html)
* [5.1.1.4.1.2. `FedEval.dataset.FEMNIST`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/dataset/FEMNIST/index.html)
* [5.1.1.4.1.3. `FedEval.dataset.FedDataBase`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/dataset/FedDataBase/index.html)
* [5.1.1.4.1.4. `FedEval.dataset.FedImage`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/dataset/FedImage/index.html)
* [5.1.1.4.1.5. `FedEval.dataset.FedMatrix`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/dataset/FedMatrix/index.html)
* [5.1.1.4.1.6. `FedEval.dataset.Sentiment140`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/dataset/Sentiment140/index.html)
* [5.1.1.4.1.7. `FedEval.dataset.Shakespeare`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/dataset/Shakespeare/index.html)
* [5.1.1.5. `FedEval.model`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/model/index.html)
* [5.1.1.5.1.1. `FedEval.model.LeNet`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/model/LeNet/index.html)
* [5.1.1.5.1.2. `FedEval.model.MLP`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/model/MLP/index.html)
* [5.1.1.5.1.3. `FedEval.model.StackedLSTM`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/model/StackedLSTM/index.html)
* [5.1.1.6. `FedEval.role`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/role/index.html)
* [5.1.1.6.1.1. `FedEval.role.Client`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/role/Client/index.html)
* [5.1.1.6.1.2. `FedEval.role.Server`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/role/Server/index.html)
* [5.1.1.6.1.3. `FedEval.role.container`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/role/container/index.html)
* [5.1.1.6.1.4. `FedEval.role.logger`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/role/logger/index.html)
* [5.1.1.6.1.5. `FedEval.role.node`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/role/node/index.html)
* [5.1.1.7. `FedEval.secure_protocols`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/secure_protocols/index.html)
* [5.1.1.7.1.1. `FedEval.secure_protocols.encryption_base`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/secure_protocols/encryption_base/index.html)
* [5.1.1.7.1.2. `FedEval.secure_protocols.finite_field`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/secure_protocols/finite_field/index.html)
* [5.1.1.7.1.3. `FedEval.secure_protocols.shamir_secret_sharing`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/secure_protocols/shamir_secret_sharing/index.html)
* [5.1.1.8. `FedEval.strategy`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/strategy/index.html)
* [5.1.1.8.1.1. `FedEval.strategy.FedAvg`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/strategy/FedAvg/index.html)
* [5.1.1.8.1.2. `FedEval.strategy.FedOpt`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/strategy/FedOpt/index.html)
* [5.1.1.8.1.3. `FedEval.strategy.FedProx`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/strategy/FedProx/index.html)
* [5.1.1.8.1.4. `FedEval.strategy.FedSCA`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/strategy/FedSCA/index.html)
* [5.1.1.8.1.5. `FedEval.strategy.FedSTC`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/strategy/FedSTC/index.html)
* [5.1.1.8.1.6. `FedEval.strategy.FedSVD`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/strategy/FedSVD/index.html)
* [5.1.1.8.1.7. `FedEval.strategy.FederatedStrategy`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/strategy/FederatedStrategy/index.html)
* [5.1.1.8.1.8. `FedEval.strategy.FetchSGD`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/strategy/FetchSGD/index.html)
* [5.1.1.8.1.9. `FedEval.strategy.MFedAvg`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/strategy/MFedAvg/index.html)
* [5.1.1.8.1.10. `FedEval.strategy.PaillierAggregation`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/strategy/PaillierAggregation/index.html)
* [5.1.1.8.1.11. `FedEval.strategy.SecureAggregation`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/strategy/SecureAggregation/index.html)
* [5.1.1.8.1.12. `FedEval.strategy.base`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/strategy/base/index.html)
* [5.1.1.8.1.13. `FedEval.strategy.build_in`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/strategy/build_in/index.html)
* [5.1.1.9. `FedEval.utils`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/utils/index.html)
* [5.1.1.9.1.1. `FedEval.utils.dbapi`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/utils/dbapi/index.html)
* [5.1.1.9.1.2. `FedEval.utils.log_analysis`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/utils/log_analysis/index.html)
* [5.1.1.9.1.3. `FedEval.utils.multi_threads`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/utils/multi_threads/index.html)
* [5.1.1.9.1.4. `FedEval.utils.parameter_parser`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/utils/parameter_parser/index.html)
* [5.1.1.9.1.5. `FedEval.utils.utils`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/utils/utils/index.html)
* [5.1.2.1. `FedEval.run`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/run/index.html)
* [5.1.2.2. `FedEval.run_util`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/run_util/index.html)
---
# 5.1. FedEval — FedEval documentation
* [](https://fedeval.readthedocs.io/en/latest/index.html)
* [5\. API Reference](https://fedeval.readthedocs.io/en/latest/autoapi/index.html)
* 5.1. `FedEval`
* [Edit on GitHub](https://github.com/Di-Chai/FedEval/blob/master/docs/autoapi/FedEval/index.rst)
* * *
5.1. [`FedEval`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/index.html#module-FedEval "FedEval")
[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/index.html#module-FedEval "Link to this heading")
==============================================================================================================================================================================================================================
5.1.1. Subpackages[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/index.html#subpackages "Link to this heading")
------------------------------------------------------------------------------------------------------------------------------
* [5.1.1.1. `FedEval.aggregator`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/aggregator/index.html)
* [5.1.1.1.1.1. `FedEval.aggregator.ModelWeight`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/aggregator/ModelWeight/index.html)
* [5.1.1.1.1.2. `FedEval.aggregator.bulyan`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/aggregator/bulyan/index.html)
* [5.1.1.1.1.3. `FedEval.aggregator.krum`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/aggregator/krum/index.html)
* [5.1.1.1.1.4. `FedEval.aggregator.mean`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/aggregator/mean/index.html)
* [5.1.1.1.1.5. `FedEval.aggregator.median`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/aggregator/median/index.html)
* [5.1.1.1.1.6. `FedEval.aggregator.norm_clipping`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/aggregator/norm_clipping/index.html)
* [5.1.1.1.1.7. `FedEval.aggregator.trim`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/aggregator/trim/index.html)
* [5.1.1.1.1.8. `FedEval.aggregator.utils`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/aggregator/utils/index.html)
* [5.1.1.2. `FedEval.communicaiton`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/communicaiton/index.html)
* [5.1.1.2.1.1. `FedEval.communicaiton.comm_pb2`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/communicaiton/comm_pb2/index.html)
* [5.1.1.2.1.2. `FedEval.communicaiton.comm_pb2_grpc`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/communicaiton/comm_pb2_grpc/index.html)
* [5.1.1.2.1.3. `FedEval.communicaiton.communicator`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/communicaiton/communicator/index.html)
* [5.1.1.2.1.4. `FedEval.communicaiton.events`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/communicaiton/events/index.html)
* [5.1.1.2.1.5. `FedEval.communicaiton.flask_communicator`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/communicaiton/flask_communicator/index.html)
* [5.1.1.2.1.6. `FedEval.communicaiton.grpc_communicator`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/communicaiton/grpc_communicator/index.html)
* [5.1.1.2.1.7. `FedEval.communicaiton.model_weights_io`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/communicaiton/model_weights_io/index.html)
* [5.1.1.2.1.8. `FedEval.communicaiton.preset`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/communicaiton/preset/index.html)
* [5.1.1.3. `FedEval.config`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/config/index.html)
* [5.1.1.3.1.1. `FedEval.config.configuration`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/config/configuration/index.html)
* [5.1.1.3.1.2. `FedEval.config.filename_checker`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/config/filename_checker/index.html)
* [5.1.1.3.1.3. `FedEval.config.role`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/config/role/index.html)
* [5.1.1.3.1.4. `FedEval.config.service_interface`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/config/service_interface/index.html)
* [5.1.1.3.1.5. `FedEval.config.singleton`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/config/singleton/index.html)
* [5.1.1.3.1.6. `FedEval.config.test_config`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/config/test_config/index.html)
* [5.1.1.3.1.7. `FedEval.config.test_singleton`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/config/test_singleton/index.html)
* [5.1.1.4. `FedEval.dataset`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/dataset/index.html)
* [5.1.1.4.1.1. `FedEval.dataset.CelebA`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/dataset/CelebA/index.html)
* [5.1.1.4.1.2. `FedEval.dataset.FEMNIST`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/dataset/FEMNIST/index.html)
* [5.1.1.4.1.3. `FedEval.dataset.FedDataBase`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/dataset/FedDataBase/index.html)
* [5.1.1.4.1.4. `FedEval.dataset.FedImage`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/dataset/FedImage/index.html)
* [5.1.1.4.1.5. `FedEval.dataset.FedMatrix`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/dataset/FedMatrix/index.html)
* [5.1.1.4.1.6. `FedEval.dataset.Sentiment140`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/dataset/Sentiment140/index.html)
* [5.1.1.4.1.7. `FedEval.dataset.Shakespeare`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/dataset/Shakespeare/index.html)
* [5.1.1.5. `FedEval.model`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/model/index.html)
* [5.1.1.5.1.1. `FedEval.model.LeNet`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/model/LeNet/index.html)
* [5.1.1.5.1.2. `FedEval.model.MLP`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/model/MLP/index.html)
* [5.1.1.5.1.3. `FedEval.model.StackedLSTM`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/model/StackedLSTM/index.html)
* [5.1.1.6. `FedEval.role`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/role/index.html)
* [5.1.1.6.1.1. `FedEval.role.Client`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/role/Client/index.html)
* [5.1.1.6.1.2. `FedEval.role.Server`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/role/Server/index.html)
* [5.1.1.6.1.3. `FedEval.role.container`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/role/container/index.html)
* [5.1.1.6.1.4. `FedEval.role.logger`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/role/logger/index.html)
* [5.1.1.6.1.5. `FedEval.role.node`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/role/node/index.html)
* [5.1.1.7. `FedEval.secure_protocols`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/secure_protocols/index.html)
* [5.1.1.7.1.1. `FedEval.secure_protocols.encryption_base`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/secure_protocols/encryption_base/index.html)
* [5.1.1.7.1.2. `FedEval.secure_protocols.finite_field`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/secure_protocols/finite_field/index.html)
* [5.1.1.7.1.3. `FedEval.secure_protocols.shamir_secret_sharing`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/secure_protocols/shamir_secret_sharing/index.html)
* [5.1.1.8. `FedEval.strategy`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/strategy/index.html)
* [5.1.1.8.1.1. `FedEval.strategy.FedAvg`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/strategy/FedAvg/index.html)
* [5.1.1.8.1.2. `FedEval.strategy.FedOpt`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/strategy/FedOpt/index.html)
* [5.1.1.8.1.3. `FedEval.strategy.FedProx`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/strategy/FedProx/index.html)
* [5.1.1.8.1.4. `FedEval.strategy.FedSCA`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/strategy/FedSCA/index.html)
* [5.1.1.8.1.5. `FedEval.strategy.FedSTC`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/strategy/FedSTC/index.html)
* [5.1.1.8.1.6. `FedEval.strategy.FedSVD`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/strategy/FedSVD/index.html)
* [5.1.1.8.1.7. `FedEval.strategy.FederatedStrategy`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/strategy/FederatedStrategy/index.html)
* [5.1.1.8.1.8. `FedEval.strategy.FetchSGD`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/strategy/FetchSGD/index.html)
* [5.1.1.8.1.9. `FedEval.strategy.MFedAvg`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/strategy/MFedAvg/index.html)
* [5.1.1.8.1.10. `FedEval.strategy.PaillierAggregation`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/strategy/PaillierAggregation/index.html)
* [5.1.1.8.1.11. `FedEval.strategy.SecureAggregation`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/strategy/SecureAggregation/index.html)
* [5.1.1.8.1.12. `FedEval.strategy.base`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/strategy/base/index.html)
* [5.1.1.8.1.13. `FedEval.strategy.build_in`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/strategy/build_in/index.html)
* [5.1.1.9. `FedEval.utils`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/utils/index.html)
* [5.1.1.9.1.1. `FedEval.utils.dbapi`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/utils/dbapi/index.html)
* [5.1.1.9.1.2. `FedEval.utils.log_analysis`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/utils/log_analysis/index.html)
* [5.1.1.9.1.3. `FedEval.utils.multi_threads`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/utils/multi_threads/index.html)
* [5.1.1.9.1.4. `FedEval.utils.parameter_parser`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/utils/parameter_parser/index.html)
* [5.1.1.9.1.5. `FedEval.utils.utils`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/utils/utils/index.html)
5.1.2. Submodules[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/index.html#submodules "Link to this heading")
----------------------------------------------------------------------------------------------------------------------------
* [5.1.2.1. `FedEval.run`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/run/index.html)
* [5.1.2.2. `FedEval.run_util`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/run_util/index.html)
5.1.3. Package Contents[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/index.html#package-contents "Link to this heading")
----------------------------------------------------------------------------------------------------------------------------------------
FedEval.\_\_version\_\_ _\= '1.0.0'_[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/index.html#FedEval.__version__ "Link to this definition")
---
# 5.1.2.1. FedEval.run — FedEval documentation
* [](https://fedeval.readthedocs.io/en/latest/index.html)
* [5\. API Reference](https://fedeval.readthedocs.io/en/latest/autoapi/index.html)
* [5.1. `FedEval`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/index.html)
* 5.1.2.1. `FedEval.run`
* [Edit on GitHub](https://github.com/Di-Chai/FedEval/blob/master/docs/autoapi/FedEval/run/index.rst)
* * *
5.1.2.1. [`FedEval.run`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/run/index.html#module-FedEval.run "FedEval.run")
[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/run/index.html#module-FedEval.run "Link to this heading")
==========================================================================================================================================================================================================================================================
5.1.2.1.1. Module Contents[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/run/index.html#module-contents "Link to this heading")
----------------------------------------------------------------------------------------------------------------------------------------------
### 5.1.2.1.1.1. Functions[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/run/index.html#functions "Link to this heading")
| | |
| --- | --- |
| [`generate_data`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/run/index.html#FedEval.run.generate_data "FedEval.run.generate_data")
(\[save\_file\]) | |
| [`run`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/run/index.html#FedEval.run.run "FedEval.run.run")
(role\[, config\_path, unified\_job\_time, container\_id\]) | |
| [`generate_docker_compose_server`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/run/index.html#FedEval.run.generate_docker_compose_server "FedEval.run.generate_docker_compose_server")
(path) | |
| [`generate_docker_compose_local`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/run/index.html#FedEval.run.generate_docker_compose_local "FedEval.run.generate_docker_compose_local")
(path) | |
### 5.1.2.1.1.2. Attributes[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/run/index.html#attributes "Link to this heading")
| | |
| --- | --- |
| [`UNIFIED_JOB_TIME`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/run/index.html#FedEval.run.UNIFIED_JOB_TIME "FedEval.run.UNIFIED_JOB_TIME") | |
| [`args_parser`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/run/index.html#FedEval.run.args_parser "FedEval.run.args_parser") | |
FedEval.run.UNIFIED\_JOB\_TIME[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/run/index.html#FedEval.run.UNIFIED_JOB_TIME "Link to this definition")
FedEval.run.generate\_data(_save\_file\=True_)[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/run/index.html#FedEval.run.generate_data "Link to this definition")
FedEval.run.run(_role: str_, _config\_path\=None_, _unified\_job\_time\=None_, _container\_id\=None_)[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/run/index.html#FedEval.run.run "Link to this definition")
FedEval.run.generate\_docker\_compose\_server(_path_)[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/run/index.html#FedEval.run.generate_docker_compose_server "Link to this definition")
FedEval.run.generate\_docker\_compose\_local(_path_)[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/run/index.html#FedEval.run.generate_docker_compose_local "Link to this definition")
FedEval.run.args\_parser[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/run/index.html#FedEval.run.args_parser "Link to this definition")
---
# 5.1.2.2. FedEval.run_util — FedEval documentation
* [](https://fedeval.readthedocs.io/en/latest/index.html)
* [5\. API Reference](https://fedeval.readthedocs.io/en/latest/autoapi/index.html)
* [5.1. `FedEval`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/index.html)
* 5.1.2.2. `FedEval.run_util`
* [Edit on GitHub](https://github.com/Di-Chai/FedEval/blob/master/docs/autoapi/FedEval/run_util/index.rst)
* * *
5.1.2.2. [`FedEval.run_util`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/run_util/index.html#module-FedEval.run_util "FedEval.run_util")
[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/run_util/index.html#module-FedEval.run_util "Link to this heading")
========================================================================================================================================================================================================================================================================================
5.1.2.2.1. Module Contents[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/run_util/index.html#module-contents "Link to this heading")
---------------------------------------------------------------------------------------------------------------------------------------------------
### 5.1.2.2.1.1. Functions[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/run_util/index.html#functions "Link to this heading")
| | |
| --- | --- |
| [`check_status`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/run_util/index.html#FedEval.run_util.check_status "FedEval.run_util.check_status")
(host) | |
| [`local_stop`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/run_util/index.html#FedEval.run_util.local_stop "FedEval.run_util.local_stop")
() | |
| [`server_stop`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/run_util/index.html#FedEval.run_util.server_stop "FedEval.run_util.server_stop")
() | |
| [`local_recursive_ls`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/run_util/index.html#FedEval.run_util.local_recursive_ls "FedEval.run_util.local_recursive_ls")
(path) | |
| [`remote_recursive_ls`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/run_util/index.html#FedEval.run_util.remote_recursive_ls "FedEval.run_util.remote_recursive_ls")
(sftp, remote\_dir\_base, path) | |
| [`remote_recursive_mkdir`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/run_util/index.html#FedEval.run_util.remote_recursive_mkdir "FedEval.run_util.remote_recursive_mkdir")
(sftp, remote\_path) | |
| [`local_recursive_mkdir`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/run_util/index.html#FedEval.run_util.local_recursive_mkdir "FedEval.run_util.local_recursive_mkdir")
(local\_path) | |
| [`upload_to_server`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/run_util/index.html#FedEval.run_util.upload_to_server "FedEval.run_util.upload_to_server")
(local\_dirs\[, file\_type\]) | |
| [`download_from_server`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/run_util/index.html#FedEval.run_util.download_from_server "FedEval.run_util.download_from_server")
(remote\_dirs, file\_type) | |
| [`recursive_update_dict`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/run_util/index.html#FedEval.run_util.recursive_update_dict "FedEval.run_util.recursive_update_dict")
(target, update) | |
| [`_handle_errors`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/run_util/index.html#FedEval.run_util._handle_errors "FedEval.run_util._handle_errors")
(error) | |
| [`run_util`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/run_util/index.html#FedEval.run_util.run_util "FedEval.run_util.run_util")
(execution, mode, config\[, overwrite\_config, ...\]) | |
| [`write_history`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/run_util/index.html#FedEval.run_util.write_history "FedEval.run_util.write_history")
() | |
| [`compute_gradients`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/run_util/index.html#FedEval.run_util.compute_gradients "FedEval.run_util.compute_gradients")
(model, x, y) | |
| [`fed_sgd_simulator`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/run_util/index.html#FedEval.run_util.fed_sgd_simulator "FedEval.run_util.fed_sgd_simulator")
(UNIFIED\_JOB\_TIME) | |
| [`central_simulator`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/run_util/index.html#FedEval.run_util.central_simulator "FedEval.run_util.central_simulator")
(UNIFIED\_JOB\_TIME) | |
| [`local_simulator`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/run_util/index.html#FedEval.run_util.local_simulator "FedEval.run_util.local_simulator")
(UNIFIED\_JOB\_TIME) | |
### 5.1.2.2.1.2. Attributes[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/run_util/index.html#attributes "Link to this heading")
| | |
| --- | --- |
| [`sudo`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/run_util/index.html#FedEval.run_util.sudo "FedEval.run_util.sudo") | |
| [`args_parser`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/run_util/index.html#FedEval.run_util.args_parser "FedEval.run_util.args_parser") | |
FedEval.run\_util.sudo _\= ''_[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/run_util/index.html#FedEval.run_util.sudo "Link to this definition")
FedEval.run\_util.check\_status(_host_)[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/run_util/index.html#FedEval.run_util.check_status "Link to this definition")
FedEval.run\_util.local\_stop()[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/run_util/index.html#FedEval.run_util.local_stop "Link to this definition")
FedEval.run\_util.server\_stop()[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/run_util/index.html#FedEval.run_util.server_stop "Link to this definition")
FedEval.run\_util.local\_recursive\_ls(_path_)[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/run_util/index.html#FedEval.run_util.local_recursive_ls "Link to this definition")
FedEval.run\_util.remote\_recursive\_ls(_sftp_, _remote\_dir\_base_, _path_)[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/run_util/index.html#FedEval.run_util.remote_recursive_ls "Link to this definition")
FedEval.run\_util.remote\_recursive\_mkdir(_sftp_, _remote\_path_)[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/run_util/index.html#FedEval.run_util.remote_recursive_mkdir "Link to this definition")
FedEval.run\_util.local\_recursive\_mkdir(_local\_path_)[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/run_util/index.html#FedEval.run_util.local_recursive_mkdir "Link to this definition")
FedEval.run\_util.upload\_to\_server(_local\_dirs_, _file\_type\=('.py', '.yml', '.css', '.html', 'eot', 'svg', 'ttf', 'woff')_)[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/run_util/index.html#FedEval.run_util.upload_to_server "Link to this definition")
FedEval.run\_util.download\_from\_server(_remote\_dirs_, _file\_type_)[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/run_util/index.html#FedEval.run_util.download_from_server "Link to this definition")
FedEval.run\_util.recursive\_update\_dict(_target: dict_, _update: dict_)[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/run_util/index.html#FedEval.run_util.recursive_update_dict "Link to this definition")
FedEval.run\_util.\_handle\_errors(_error_)[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/run_util/index.html#FedEval.run_util._handle_errors "Link to this definition")
FedEval.run\_util.run\_util(_execution_, _mode_, _config_, _overwrite\_config\=False_, _skip\_if\_exit\=True_, _\*\*kwargs_)[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/run_util/index.html#FedEval.run_util.run_util "Link to this definition")
FedEval.run\_util.write\_history()[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/run_util/index.html#FedEval.run_util.write_history "Link to this definition")
FedEval.run\_util.compute\_gradients(_model_, _x_, _y_)[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/run_util/index.html#FedEval.run_util.compute_gradients "Link to this definition")
FedEval.run\_util.fed\_sgd\_simulator(_UNIFIED\_JOB\_TIME_)[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/run_util/index.html#FedEval.run_util.fed_sgd_simulator "Link to this definition")
FedEval.run\_util.central\_simulator(_UNIFIED\_JOB\_TIME_)[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/run_util/index.html#FedEval.run_util.central_simulator "Link to this definition")
FedEval.run\_util.local\_simulator(_UNIFIED\_JOB\_TIME_)[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/run_util/index.html#FedEval.run_util.local_simulator "Link to this definition")
FedEval.run\_util.args\_parser[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/run_util/index.html#FedEval.run_util.args_parser "Link to this definition")
---
# 5.1.1.1. FedEval.aggregator — FedEval documentation
* [](https://fedeval.readthedocs.io/en/latest/index.html)
* [5\. API Reference](https://fedeval.readthedocs.io/en/latest/autoapi/index.html)
* [5.1. `FedEval`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/index.html)
* 5.1.1.1. `FedEval.aggregator`
* [Edit on GitHub](https://github.com/Di-Chai/FedEval/blob/master/docs/autoapi/FedEval/aggregator/index.rst)
* * *
5.1.1.1. [`FedEval.aggregator`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/aggregator/index.html#module-FedEval.aggregator "FedEval.aggregator")
[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/aggregator/index.html#module-FedEval.aggregator "Link to this heading")
====================================================================================================================================================================================================================================================================================================
5.1.1.1.1. Submodules[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/aggregator/index.html#submodules "Link to this heading")
-------------------------------------------------------------------------------------------------------------------------------------------
* [5.1.1.1.1.1. `FedEval.aggregator.ModelWeight`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/aggregator/ModelWeight/index.html)
* [5.1.1.1.1.2. `FedEval.aggregator.bulyan`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/aggregator/bulyan/index.html)
* [5.1.1.1.1.3. `FedEval.aggregator.krum`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/aggregator/krum/index.html)
* [5.1.1.1.1.4. `FedEval.aggregator.mean`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/aggregator/mean/index.html)
* [5.1.1.1.1.5. `FedEval.aggregator.median`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/aggregator/median/index.html)
* [5.1.1.1.1.6. `FedEval.aggregator.norm_clipping`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/aggregator/norm_clipping/index.html)
* [5.1.1.1.1.7. `FedEval.aggregator.trim`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/aggregator/trim/index.html)
* [5.1.1.1.1.8. `FedEval.aggregator.utils`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/aggregator/utils/index.html)
5.1.1.1.2. Package Contents[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/aggregator/index.html#package-contents "Link to this heading")
-------------------------------------------------------------------------------------------------------------------------------------------------------
### 5.1.1.1.2.1. Classes[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/aggregator/index.html#classes "Link to this heading")
| | |
| --- | --- |
| [`ParamAggregator`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/aggregator/index.html#FedEval.aggregator.ParamAggregator "FedEval.aggregator.ParamAggregator") | A class to aggregate the parameters from different clients. |
### 5.1.1.1.2.2. Functions[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/aggregator/index.html#functions "Link to this heading")
| | |
| --- | --- |
| [`_layerwise_aggregate`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/aggregator/index.html#FedEval.aggregator._layerwise_aggregate "FedEval.aggregator._layerwise_aggregate")
(...) | Aggregate the given client-side params layer-wise. |
| [`weighted_average`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/aggregator/index.html#FedEval.aggregator.weighted_average "FedEval.aggregator.weighted_average")
(...) | return the weighted average of the given client-side params according to the given weights. |
| [`trimmed_mean`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/aggregator/index.html#FedEval.aggregator.trimmed_mean "FedEval.aggregator.trimmed_mean")
(→ FedEval.aggregator.ModelWeight.ModelWeights) | Return the coordinate-wise mean of the given client-side params after trimming a certain ratio |
| [`coordinate_wise_median`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/aggregator/index.html#FedEval.aggregator.coordinate_wise_median "FedEval.aggregator.coordinate_wise_median")
(...) | return the coordinate-wise median of the given client-side params. |
| [`trimmed_coordinate_wise_median`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/aggregator/index.html#FedEval.aggregator.trimmed_coordinate_wise_median "FedEval.aggregator.trimmed_coordinate_wise_median")
(...) | Return the coordinate-wise median of the given client-side params after trimming a certain ratio |
| [`krum`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/aggregator/krum/index.html#module-FedEval.aggregator.krum "FedEval.aggregator.krum") | Krum Implementations |
| [`norm_clip`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/aggregator/index.html#FedEval.aggregator.norm_clip "FedEval.aggregator.norm_clip")
(→ FedEval.aggregator.ModelWeight.ModelWeights) | Aggregate the given client-side params by norm clipping. |
| [`bulyan`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/aggregator/index.html#FedEval.aggregator.bulyan "FedEval.aggregator.bulyan") | |
### 5.1.1.1.2.3. Attributes[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/aggregator/index.html#attributes "Link to this heading")
| | |
| --- | --- |
| [`ModelWeights`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/aggregator/index.html#FedEval.aggregator.ModelWeights "FedEval.aggregator.ModelWeights") | |
FedEval.aggregator.ModelWeights[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/aggregator/index.html#FedEval.aggregator.ModelWeights "Link to this definition")
FedEval.aggregator.\_layerwise\_aggregate(_params: Iterable\[FedEval.aggregator.ModelWeight.ModelWeights\]_, _func: Callable\[\[numpy.ndarray\], numpy.ndarray\]_) → FedEval.aggregator.ModelWeight.ModelWeights[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/aggregator/index.html#FedEval.aggregator._layerwise_aggregate "Link to this definition")
Aggregate the given client-side params layer-wise.
Parameters:
* **params** (_Iterable__\[__ModelWeights__\]_) – the weights form different clients, ordered like \[params1, params2, …\]
* **func** (_Callable__\[__\[__ndarray__\]__,_ _ndarray__\]_) – the aggregation function to apply to stacked layers from each client. And they will be called with axis=0.
Returns:
the aggregated parameters which have the same format with any instance from the params
Return type:
ModelWeights
Example
\>>> params \= \[\[np.array(\[\[1, 2\], \[3, 4\]\]), np.array(\[\[5, 6\], \[7, 8\]\])\], \[np.array(\[\[9, 10\], \[11, 12\]\]), np.array(\[\[13, 14\], \[15, 16\]\])\]\]
\>>> \_layerwise\_aggregate(params, np.mean)
\[array(\[\[5., 6.\],\
\[7., 8.\]\]),\
array(\[\[9., 10.\],\
\[11., 12.\]\])\]
\>>> \_layerwise\_aggregate(params, np.median)
\[array(\[\[1., 2.\],\
\[3., 4.\]\]),\
array(\[\[5., 6.\],\
\[7., 8.\]\])\]
FedEval.aggregator.weighted\_average(_client\_params: Iterable\[FedEval.aggregator.ModelWeight.ModelWeights\]_, _weights: Iterable\[float | int\]_) → FedEval.aggregator.ModelWeight.ModelWeights[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/aggregator/index.html#FedEval.aggregator.weighted_average "Link to this definition")
return the weighted average of the given client-side params according to the given weights.
Parameters:
* **client\_params** (_Iterable__\[__ModelWeights__\]_) – the weights form different clients, ordered like \[params1, params2, …\]
* **weights** (_Iterable__\[__Union__\[__float__,_ _int__\]__\]_) – aggregate weights of different clients, usually set according to the clients’ training sample size. E.g., A, B, and C have 10, 20, and 30 images, then the aggregate\_weights can be \[1/6, 1/3, 1/2\] or \[10, 20, 30\].
Raises:
**ValueError** – if the number of client params and weights are not the same
Returns:
the aggregated parameters which have the same format with any instance from the client\_params
Return type:
ModelWeights
FedEval.aggregator.trimmed\_mean(_client\_params: Iterable\[FedEval.aggregator.ModelWeight.ModelWeights\]_, _ratio: float \= 0.05_) → FedEval.aggregator.ModelWeight.ModelWeights[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/aggregator/index.html#FedEval.aggregator.trimmed_mean "Link to this definition")
Return the coordinate-wise mean of the given client-side params after trimming a certain ratio of the extreme parameter values.
Parameters:
* **client\_params** (_Iterable__\[__ModelWeights__\]_) – The weights from different clients, ordered like \[params1, params2, …\].
* **ratio** (_float__,_ _optional_) – The ratio of extreme parameter values to trim. Should be between 0 and 0.5. Defaults to 0.05.
Raises:
**ValueError** – If trim\_ratio is not in \[0, 0.5).\
\
Returns:\
\
The aggregated parameters which have the same format with any instance from the client\_params.\
\
Return type:\
\
ModelWeights\
\
FedEval.aggregator.coordinate\_wise\_median(_client\_params: Iterable\[FedEval.aggregator.ModelWeight.ModelWeights\]_) → FedEval.aggregator.ModelWeight.ModelWeights[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/aggregator/index.html#FedEval.aggregator.coordinate_wise_median "Link to this definition")\
\
return the coordinate-wise median of the given client-side params.\
\
Parameters:\
\
**client\_params** (_Iterable__\[__ModelWeights__\]_) – the weights form different clients, ordered like \[params1, params2, …\]\
\
Returns:\
\
the aggregated parameters which have the same format with any instance from the client\_params\
\
Return type:\
\
ModelWeights\
\
FedEval.aggregator.trimmed\_coordinate\_wise\_median(_client\_params: Iterable\[FedEval.aggregator.ModelWeight.ModelWeights\]_, _ratio: float \= 0.05_) → FedEval.aggregator.ModelWeight.ModelWeights[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/aggregator/index.html#FedEval.aggregator.trimmed_coordinate_wise_median "Link to this definition")\
\
Return the coordinate-wise median of the given client-side params after trimming a certain ratio of the extreme parameter values.\
\
Parameters:\
\
* **client\_params** (_Iterable__\[__ModelWeights__\]_) – The weights from different clients, ordered like \[params1, params2, …\].\
\
* **ratio** (_float__,_ _optional_) – The ratio of extreme parameter values to trim. Should be between 0 and 0.5. Defaults to 0.05.\
\
\
Raises:\
\
**ValueError** – If trim\_ratio is in \[0, 0.5).\
\
Returns:\
\
The aggregated parameters which have the same format with any instance from the client\_params.\
\
Return type:\
\
ModelWeights\
\
FedEval.aggregator.krum(_params: Iterable\[FedEval.aggregator.ModelWeight.ModelWeights\]_, _select: int | None \= 1_, _dist\_metric: str \= 'euclidean'_) → FedEval.aggregator.ModelWeight.ModelWeights[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/aggregator/index.html#FedEval.aggregator.krum "Link to this definition")\
\
FedEval.aggregator.norm\_clip(_client\_params: Iterable\[FedEval.aggregator.ModelWeight.ModelWeights\]_, _server\_param: FedEval.aggregator.ModelWeight.ModelWeights_, _threshold: float | None \= 0.5_) → FedEval.aggregator.ModelWeight.ModelWeights[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/aggregator/index.html#FedEval.aggregator.norm_clip "Link to this definition")\
\
Aggregate the given client-side params by norm clipping.\
\
Parameters:\
\
* **client\_params** (_Iterable__\[__ModelWeights__\]_) – the weights form different clients, ordered like \[params1, params2, …\]\
\
* **server\_param** (_ModelWeights_) – the weights at the server-side\
\
* **threshold** (_Optional__\[__float__\]__,_ _optional_) – the threshold of the norm. Defaults to 0.5.\
\
\
Raises:\
\
**ValueError** – If threshold is invalid.\
\
Returns:\
\
the aggregated model weights.\
\
Return type:\
\
ModelWeights\
\
FedEval.aggregator.bulyan(_params: Iterable\[FedEval.aggregator.ModelWeight.ModelWeights\]_, _ratio: float \= 0.05_, _select: int | None \= 1_, _dist\_metric: str \= 'euclidean'_) → FedEval.aggregator.ModelWeight.ModelWeights[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/aggregator/index.html#FedEval.aggregator.bulyan "Link to this definition")\
\
Bulyan aggregation method.\
\
Parameters:\
\
* **params** (_Iterable__\[__ModelWeights__\]_) – List of model weights.\
\
* **ratio** (_float_) – Ratio of params to be trimmed. Defaults to 0.05.\
\
* **select** (_Optional__\[__int__\]__,_ _optional_) – Number of clients to be selected. Defaults to 1.\
\
* **dist\_metric** (_str__,_ _optional_) – Distance metric. Defaults to ‘euclidean’.\
\
\
Raises:\
\
**ValueError** – Invalid number of selected params, or invalid trim ratio.\
\
Returns:\
\
Aggregated model weights.\
\
Return type:\
\
ModelWeights\
\
_class_ FedEval.aggregator.ParamAggregator(_params: Iterable\[ModelWeight.ModelWeights\]_)[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/aggregator/index.html#FedEval.aggregator.ParamAggregator "Link to this definition")\
\
A class to aggregate the parameters from different clients.\
\
average() → ModelWeight.ModelWeights[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/aggregator/index.html#FedEval.aggregator.ParamAggregator.average "Link to this definition")\
\
return the average of the given client-side params.\
\
Returns:\
\
the aggregated parameters which have the same format with any instance from the client\_params\
\
Return type:\
\
ModelWeights\
\
weighted\_average(_weights: Iterable\[float | int\]_) → ModelWeight.ModelWeights[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/aggregator/index.html#FedEval.aggregator.ParamAggregator.weighted_average "Link to this definition")\
\
return the weighted average of the given client-side params according to the given weights.\
\
Parameters:\
\
**weights** (_Iterable__\[__Union__\[__float__,_ _int__\]__\]_) – aggregate weights of different clients, usually set according to the clients’ training sample size. E.g., A, B, and C have 10, 20, and 30 images, then the aggregate\_weights can be \[1/6, 1/3, 1/2\] or \[10, 20, 30\].\
\
Returns:\
\
the aggregated parameters which have the same format with any instance from the client\_params\
\
Return type:\
\
ModelWeights\
\
median() → ModelWeight.ModelWeights[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/aggregator/index.html#FedEval.aggregator.ParamAggregator.median "Link to this definition")\
\
return the coordinate-wise median of the given client-side params.\
\
Returns:\
\
the aggregated parameters which have the same format with any instance from the client\_params\
\
Return type:\
\
ModelWeights\
\
trimmed\_median(_ratio: float \= 0.05_) → ModelWeight.ModelWeights[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/aggregator/index.html#FedEval.aggregator.ParamAggregator.trimmed_median "Link to this definition")\
\
Return the coordinate-wise median of the given client-side params after trimming a certain ratio of the extreme parameter values.\
\
Parameters:\
\
**ratio** (_float__,_ _optional_) – The ratio of extreme parameter values to trim. Should be between 0 and 1. Defaults to 0.05.\
\
Raises:\
\
**ValueError** – If trim\_ratio is not in \[0, 0.5).\
\
Returns:\
\
The aggregated parameters which have the same format with any instance from the client\_params.\
\
Return type:\
\
ModelWeights\
\
trimmed\_mean(_ratio: float \= 0.05_) → ModelWeight.ModelWeights[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/aggregator/index.html#FedEval.aggregator.ParamAggregator.trimmed_mean "Link to this definition")\
\
Return the coordinate-wise mean of the given client-side params after trimming a certain ratio of the extreme parameter values.\
\
Parameters:\
\
**ratio** (_float__,_ _optional_) – The ratio of extreme parameter values to trim. Should be between 0 and 1. Defaults to 0.05.\
\
Raises:\
\
**ValueError** – If trim\_ratio is not in \[0, 0.5).\
\
Returns:\
\
The aggregated parameters which have the same format with any instance from the client\_params.\
\
Return type:\
\
ModelWeights\
\
krum(_select: int | None \= 1_) → ModelWeight.ModelWeights[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/aggregator/index.html#FedEval.aggregator.ParamAggregator.krum "Link to this definition")\
\
Return the krum aggregate of the given client-side params.\
\
Parameters:\
\
**select** (_int__,_ _optional_) – The number of clients to select to support multi-krum. If set to None, it will return an averaged one of all the params. Defaults to 1.\
\
Raises:\
\
**ValueError** – If select is invalid.\
\
Returns:\
\
The aggregated parameters which have the same format with any instance from the client\_params.\
\
Return type:\
\
ModelWeights\
\
bulyan(_ratio: float \= 0.05_, _select: int | None \= 1_, _dist\_metric: str \= 'euclidean'_) → ModelWeight.ModelWeights[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/aggregator/index.html#FedEval.aggregator.ParamAggregator.bulyan "Link to this definition")\
\
Return the bulyan aggregate of the given client-side params.\
\
Parameters:\
\
* **ratio** (_float__,_ _optional_) – The ratio of extreme parameter values to trim. Should be in \[0, 0.5). Defaults to 0.05.\
\
* **select** (_int__,_ _optional_) – The number of clients to select to support multi-krum. Defaults to 1.\
\
* **dist\_metric** (_str__,_ _optional_) – The distance metric to use. Defaults to ‘euclidean’.\
\
\
Raises:\
\
**ValueError** – Invalid number of selected params or trim ratio.\
\
Returns:\
\
The aggregated parameters which have the same format with any instance from the client\_params.\
\
Return type:\
\
ModelWeights\
\
norm\_clip(_server\_param: ModelWeight.ModelWeights_, _threshold: float | None \= 0.5_) → ModelWeight.ModelWeights[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/aggregator/index.html#FedEval.aggregator.ParamAggregator.norm_clip "Link to this definition")\
\
Aggregate the given client-side params by norm clipping.\
\
Parameters:\
\
* **server\_param** (_ModelWeights_) – the weights at the server-side\
\
* **threshold** (_Optional__\[__float__\]__,_ _optional_) – the threshold of the norm. Defaults to 0.5.\
\
\
Raises:\
\
**ValueError** – If threshold is invalid.\
\
Returns:\
\
the aggregated model weights.\
\
Return type:\
\
ModelWeights
---
# 5.1.1.5. FedEval.model — FedEval documentation
* [](https://fedeval.readthedocs.io/en/latest/index.html)
* [5\. API Reference](https://fedeval.readthedocs.io/en/latest/autoapi/index.html)
* [5.1. `FedEval`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/index.html)
* 5.1.1.5. `FedEval.model`
* [Edit on GitHub](https://github.com/Di-Chai/FedEval/blob/master/docs/autoapi/FedEval/model/index.rst)
* * *
5.1.1.5. [`FedEval.model`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/model/index.html#module-FedEval.model "FedEval.model")
[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/model/index.html#module-FedEval.model "Link to this heading")
======================================================================================================================================================================================================================================================================
5.1.1.5.1. Submodules[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/model/index.html#submodules "Link to this heading")
--------------------------------------------------------------------------------------------------------------------------------------
* [5.1.1.5.1.1. `FedEval.model.LeNet`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/model/LeNet/index.html)
* [5.1.1.5.1.2. `FedEval.model.MLP`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/model/MLP/index.html)
* [5.1.1.5.1.3. `FedEval.model.StackedLSTM`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/model/StackedLSTM/index.html)
5.1.1.5.2. Package Contents[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/model/index.html#package-contents "Link to this heading")
--------------------------------------------------------------------------------------------------------------------------------------------------
### 5.1.1.5.2.1. Classes[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/model/index.html#classes "Link to this heading")
| | |
| --- | --- |
| [`MLP`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/model/index.html#FedEval.model.MLP "FedEval.model.MLP") | |
| [`LeNet`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/model/index.html#FedEval.model.LeNet "FedEval.model.LeNet") | |
| [`StackedLSTM`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/model/index.html#FedEval.model.StackedLSTM "FedEval.model.StackedLSTM") | |
_class_ FedEval.model.MLP(_target\_shape_, _\*\*kwargs_)[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/model/index.html#FedEval.model.MLP "Link to this definition")
Bases: `tensorflow.keras.Model`
call(_inputs_, _training\=None_, _mask\=None_)[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/model/index.html#FedEval.model.MLP.call "Link to this definition")
_class_ FedEval.model.LeNet(_target\_shape_, _\*\*kwargs_)[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/model/index.html#FedEval.model.LeNet "Link to this definition")
Bases: `tensorflow.keras.Model`
call(_inputs_, _training\=None_, _mask\=None_)[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/model/index.html#FedEval.model.LeNet.call "Link to this definition")
_class_ FedEval.model.StackedLSTM(_target\_shape_, _\*\*kwargs_)[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/model/index.html#FedEval.model.StackedLSTM "Link to this definition")
Bases: `tensorflow.keras.Model`
call(_inputs_, _training\=None_, _mask\=None_)[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/model/index.html#FedEval.model.StackedLSTM.call "Link to this definition")
---
# 5.1.1.6. FedEval.role — FedEval documentation
* [](https://fedeval.readthedocs.io/en/latest/index.html)
* [5\. API Reference](https://fedeval.readthedocs.io/en/latest/autoapi/index.html)
* [5.1. `FedEval`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/index.html)
* 5.1.1.6. `FedEval.role`
* [Edit on GitHub](https://github.com/Di-Chai/FedEval/blob/master/docs/autoapi/FedEval/role/index.rst)
* * *
5.1.1.6. [`FedEval.role`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/role/index.html#module-FedEval.role "FedEval.role")
[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/role/index.html#module-FedEval.role "Link to this heading")
================================================================================================================================================================================================================================================================
5.1.1.6.1. Submodules[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/role/index.html#submodules "Link to this heading")
-------------------------------------------------------------------------------------------------------------------------------------
* [5.1.1.6.1.1. `FedEval.role.Client`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/role/Client/index.html)
* [5.1.1.6.1.2. `FedEval.role.Server`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/role/Server/index.html)
* [5.1.1.6.1.3. `FedEval.role.container`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/role/container/index.html)
* [5.1.1.6.1.4. `FedEval.role.logger`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/role/logger/index.html)
* [5.1.1.6.1.5. `FedEval.role.node`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/role/node/index.html)
5.1.1.6.2. Package Contents[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/role/index.html#package-contents "Link to this heading")
-------------------------------------------------------------------------------------------------------------------------------------------------
### 5.1.1.6.2.1. Classes[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/role/index.html#classes "Link to this heading")
| | |
| --- | --- |
| [`Node`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/role/index.html#FedEval.role.Node "FedEval.role.Node") | the basic of a node in federated learning network. |
| [`ClientContextManager`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/role/index.html#FedEval.role.ClientContextManager "FedEval.role.ClientContextManager") | |
| [`ClientNodeContextManager`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/role/index.html#FedEval.role.ClientNodeContextManager "FedEval.role.ClientNodeContextManager") | |
| [`Client`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/role/index.html#FedEval.role.Client "FedEval.role.Client") | a client node implementation based on FlaskNode. |
| [`Server`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/role/index.html#FedEval.role.Server "FedEval.role.Server") | a central server implementation based on FlaskNode. |
### 5.1.1.6.2.2. Attributes[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/role/index.html#attributes "Link to this heading")
| | |
| --- | --- |
| [`ContainerId`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/role/index.html#FedEval.role.ContainerId "FedEval.role.ContainerId") | |
| [`NodeId`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/role/index.html#FedEval.role.NodeId "FedEval.role.NodeId") | |
| [`CommunicationId`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/role/index.html#FedEval.role.CommunicationId "FedEval.role.CommunicationId") | |
_class_ FedEval.role.Node[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/role/index.html#FedEval.role.Node "Link to this definition")
the basic of a node in federated learning network. This class should be inherited instead of directly instantiate.
name[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/role/index.html#FedEval.role.Node.name "Link to this definition")
the name of this node instance.
Type:
str
fed\_model[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/role/index.html#FedEval.role.Node.fed_model "Link to this definition")
federated strategy instance constructed according to the given configurations.
Type:
[FedStrategyInterface](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/strategy/FederatedStrategy/index.html#FedEval.strategy.FederatedStrategy.FedStrategyInterface "FedEval.strategy.FederatedStrategy.FedStrategyInterface")
\_init\_logger(_logger\_name: str_, _log\_dir\_name: str_)[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/role/index.html#FedEval.role.Node._init_logger "Link to this definition")
_static_ config\_gpu(_container\_id\=None_)[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/role/index.html#FedEval.role.Node.config_gpu "Link to this definition")
FedEval.role.ContainerId[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/role/index.html#FedEval.role.ContainerId "Link to this definition")
FedEval.role.NodeId[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/role/index.html#FedEval.role.NodeId "Link to this definition")
FedEval.role.CommunicationId[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/role/index.html#FedEval.role.CommunicationId "Link to this definition")
_class_ FedEval.role.ClientContextManager(_id: ContainerId | str_, _tmp\_dir\_path: str_)[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/role/index.html#FedEval.role.ClientContextManager "Link to this definition")
_property_ container\_id_: ContainerId_[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/role/index.html#FedEval.role.ClientContextManager.container_id "Link to this definition")
_property_ client\_ids_: Iterable\[FedEval.config.ClientId\]_[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/role/index.html#FedEval.role.ClientContextManager.client_ids "Link to this definition")
\_allocate\_client\_ids() → Sequence\[FedEval.config.ClientId\][](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/role/index.html#FedEval.role.ClientContextManager._allocate_client_ids "Link to this definition")
allocate cid for the clients hold by this container and initiate round counters.
client\_cids allocation examples: # case 0: Given: container\_num: 2, client\_num: 13 Thus: num\_clients\_in\_each\_container -> 6 num\_clients % num\_containers -> 1 ## container\_0 client\_cids: \[0..=6\] ## container\_1 client\_cids: \[7..=12\]
\# case 1: Given: container\_num: 3, client\_num: 13 Thus: num\_clients\_in\_each\_container -> 4 num\_clients % num\_containers -> 1 ## container\_0 client\_cids: \[0..=4\] ## container\_1 client\_cids: \[5..=8\] ## container\_2 client\_cids: \[9..=12\]
set\_logger(_logger_)[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/role/index.html#FedEval.role.ClientContextManager.set_logger "Link to this definition")
get(_client\_id: FedEval.config.ClientId_) → [ClientContext](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/role/container/index.html#FedEval.role.container.ClientContext "FedEval.role.container.ClientContext")
[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/role/index.html#FedEval.role.ClientContextManager.get "Link to this definition")
_class_ FedEval.role.ClientNodeContextManager[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/role/index.html#FedEval.role.ClientNodeContextManager "Link to this definition")
_property_ online\_client\_ids_: Iterable\[FedEval.config.ClientId\]_[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/role/index.html#FedEval.role.ClientNodeContextManager.online_client_ids "Link to this definition")
activate(_node\_id: NodeId_, _comm\_id: CommunicationId_, _client\_ids: Iterable\[FedEval.config.ClientId\]_)[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/role/index.html#FedEval.role.ClientNodeContextManager.activate "Link to this definition")
recover\_from\_deactivation(_node\_id: NodeId_)[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/role/index.html#FedEval.role.ClientNodeContextManager.recover_from_deactivation "Link to this definition")
deactivate\_by\_node\_id(_node\_id: NodeId_) → Iterable\[FedEval.config.ClientId\][](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/role/index.html#FedEval.role.ClientNodeContextManager.deactivate_by_node_id "Link to this definition")
mark the given node as offline and return the corresponding offline clients.
Parameters:
**node\_id** (_NodeId_) – the id of the offline node
Returns:
the client on the given offline node.
Return type:
Iterable\[ClientId\]
deactivate\_by\_comm(_comm\_id: CommunicationId_) → Iterable\[FedEval.config.ClientId\][](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/role/index.html#FedEval.role.ClientNodeContextManager.deactivate_by_comm "Link to this definition")
get\_by\_node(_node\_id: NodeId_) → [ClientNodeContext](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/role/container/index.html#FedEval.role.container.ClientNodeContext "FedEval.role.container.ClientNodeContext")
[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/role/index.html#FedEval.role.ClientNodeContextManager.get_by_node "Link to this definition")
get\_by\_client(_client\_id: FedEval.config.ClientId_) → [ClientNodeContext](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/role/container/index.html#FedEval.role.container.ClientNodeContext "FedEval.role.container.ClientNodeContext")
[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/role/index.html#FedEval.role.ClientNodeContextManager.get_by_client "Link to this definition")
get\_by\_comm(_comm\_id: CommunicationId_) → [ClientNodeContext](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/role/container/index.html#FedEval.role.container.ClientNodeContext "FedEval.role.container.ClientNodeContext")
[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/role/index.html#FedEval.role.ClientNodeContextManager.get_by_comm "Link to this definition")
cluster\_by\_node(_selected\_clients: Iterable\[FedEval.config.ClientId\]_) → Mapping\[NodeId, Iterable\[FedEval.config.ClientId\]\][](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/role/index.html#FedEval.role.ClientNodeContextManager.cluster_by_node "Link to this definition")
_class_ FedEval.role.Client[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/role/index.html#FedEval.role.Client "Link to this definition")
Bases: [`FedEval.role.node.Node`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/role/node/index.html#FedEval.role.node.Node "FedEval.role.node.Node")
a client node implementation based on FlaskNode.
_property_ log\_dir[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/role/index.html#FedEval.role.Client.log_dir "Link to this definition")
MAX\_DATASET\_SIZE\_KEPT _\= 6000_[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/role/index.html#FedEval.role.Client.MAX_DATASET_SIZE_KEPT "Link to this definition")
\_init\_logger(_container\_id_, _\*\*kwargs_)[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/role/index.html#FedEval.role.Client._init_logger "Link to this definition")
\_register\_handles()[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/role/index.html#FedEval.role.Client._register_handles "Link to this definition")
start()[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/role/index.html#FedEval.role.Client.start "Link to this definition")
_class_ FedEval.role.Server[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/role/index.html#FedEval.role.Server "Link to this definition")
Bases: [`FedEval.role.node.Node`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/role/node/index.html#FedEval.role.node.Node "FedEval.role.node.Node")
a central server implementation based on FlaskNode.
_property_ log\_dir[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/role/index.html#FedEval.role.Server.log_dir "Link to this definition")
\_construct\_fed\_model()[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/role/index.html#FedEval.role.Server._construct_fed_model "Link to this definition")
Construct a federated model according to self.model\_config and bind it to self.fed\_model. This method only works after self.\_bind\_configs().
\_init\_logger()[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/role/index.html#FedEval.role.Server._init_logger "Link to this definition")
\_init\_metric\_states()[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/role/index.html#FedEval.role.Server._init_metric_states "Link to this definition")
\_init\_statistical\_states()[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/role/index.html#FedEval.role.Server._init_statistical_states "Link to this definition")
initialize statistics.
\_init\_control\_states()[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/role/index.html#FedEval.role.Server._init_control_states "Link to this definition")
initilize attributes for controlling.
\_init\_states()[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/role/index.html#FedEval.role.Server._init_states "Link to this definition")
\_init\_val\_and\_test\_data()[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/role/index.html#FedEval.role.Server._init_val_and_test_data "Link to this definition")
\_refresh\_update\_cache() → None[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/role/index.html#FedEval.role.Server._refresh_update_cache "Link to this definition")
\_refresh\_evaluation\_cache() → None[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/role/index.html#FedEval.role.Server._refresh_evaluation_cache "Link to this definition")
\_get\_recent\_time\_records(_recent\_num: int \= 0_) → List[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/role/index.html#FedEval.role.Server._get_recent_time_records "Link to this definition")
\_\_get\_avg\_test\_metric\_keys() → List\[str\][](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/role/index.html#FedEval.role.Server.__get_avg_test_metric_keys "Link to this definition")
\_\_get\_avg\_val\_metric\_keys() → List\[str\][](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/role/index.html#FedEval.role.Server.__get_avg_val_metric_keys "Link to this definition")
\_\_get\_cur\_used\_time() → str[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/role/index.html#FedEval.role.Server.__get_cur_used_time "Link to this definition")
\_register\_services()[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/role/index.html#FedEval.role.Server._register_services "Link to this definition")
aggregate\_train\_loss(_client\_losses_, _client\_sizes_, _cur\_round_)[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/role/index.html#FedEval.role.Server.aggregate_train_loss "Link to this definition")
\_get\_strategy\_description()[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/role/index.html#FedEval.role.Server._get_strategy_description "Link to this definition")
snapshot\_result(_cur\_time: float_) → Mapping\[str, Any\][](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/role/index.html#FedEval.role.Server.snapshot_result "Link to this definition")
\_register\_handles()[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/role/index.html#FedEval.role.Server._register_handles "Link to this definition")
process\_update()[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/role/index.html#FedEval.role.Server.process_update "Link to this definition")
server\_evaluation()[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/role/index.html#FedEval.role.Server.server_evaluation "Link to this definition")
process\_evaluate()[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/role/index.html#FedEval.role.Server.process_evaluate "Link to this definition")
train\_next\_round()[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/role/index.html#FedEval.role.Server.train_next_round "Link to this definition")
distribute\_evaluate(_eval\_best\_model\=False_)[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/role/index.html#FedEval.role.Server.distribute_evaluate "Link to this definition")
start()[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/role/index.html#FedEval.role.Server.start "Link to this definition")
start to provide services.
---
# 5.1.1.3. FedEval.config — FedEval documentation
* [](https://fedeval.readthedocs.io/en/latest/index.html)
* [5\. API Reference](https://fedeval.readthedocs.io/en/latest/autoapi/index.html)
* [5.1. `FedEval`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/index.html)
* 5.1.1.3. `FedEval.config`
* [Edit on GitHub](https://github.com/Di-Chai/FedEval/blob/master/docs/autoapi/FedEval/config/index.rst)
* * *
5.1.1.3. [`FedEval.config`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/config/index.html#module-FedEval.config "FedEval.config")
[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/config/index.html#module-FedEval.config "Link to this heading")
============================================================================================================================================================================================================================================================================
5.1.1.3.1. Submodules[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/config/index.html#submodules "Link to this heading")
---------------------------------------------------------------------------------------------------------------------------------------
* [5.1.1.3.1.1. `FedEval.config.configuration`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/config/configuration/index.html)
* [5.1.1.3.1.2. `FedEval.config.filename_checker`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/config/filename_checker/index.html)
* [5.1.1.3.1.3. `FedEval.config.role`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/config/role/index.html)
* [5.1.1.3.1.4. `FedEval.config.service_interface`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/config/service_interface/index.html)
* [5.1.1.3.1.5. `FedEval.config.singleton`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/config/singleton/index.html)
* [5.1.1.3.1.6. `FedEval.config.test_config`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/config/test_config/index.html)
* [5.1.1.3.1.7. `FedEval.config.test_singleton`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/config/test_singleton/index.html)
5.1.1.3.2. Package Contents[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/config/index.html#package-contents "Link to this heading")
---------------------------------------------------------------------------------------------------------------------------------------------------
### 5.1.1.3.2.1. Classes[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/config/index.html#classes "Link to this heading")
| | |
| --- | --- |
| [`ClientConfigurationManagerInterface`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/config/index.html#FedEval.config.ClientConfigurationManagerInterface "FedEval.config.ClientConfigurationManagerInterface") | an interface of ConfigurationManager from the client side, |
| [`ConfigurationManager`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/config/index.html#FedEval.config.ConfigurationManager "FedEval.config.ConfigurationManager") | the base class of singletons. |
| [`ConfigurationManagerInterface`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/config/index.html#FedEval.config.ConfigurationManagerInterface "FedEval.config.ConfigurationManagerInterface") | Helper class that provides a standard way to create an ABC using |
| [`ServerConfigurationManagerInterface`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/config/index.html#FedEval.config.ServerConfigurationManagerInterface "FedEval.config.ServerConfigurationManagerInterface") | an interface of ConfigurationManager from the central server side, |
| [`ServerFlaskInterface`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/config/index.html#FedEval.config.ServerFlaskInterface "FedEval.config.ServerFlaskInterface") | Generic enumeration. |
| [`Role`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/config/index.html#FedEval.config.Role "FedEval.config.Role") | Generic enumeration. |
### 5.1.1.3.2.2. Attributes[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/config/index.html#attributes "Link to this heading")
| | |
| --- | --- |
| [`DEFAULT_D_CFG_FILENAME_YAML`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/config/index.html#FedEval.config.DEFAULT_D_CFG_FILENAME_YAML "FedEval.config.DEFAULT_D_CFG_FILENAME_YAML") | |
| [`DEFAULT_MDL_CFG_FILENAME_YAML`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/config/index.html#FedEval.config.DEFAULT_MDL_CFG_FILENAME_YAML "FedEval.config.DEFAULT_MDL_CFG_FILENAME_YAML") | |
| [`DEFAULT_RT_CFG_FILENAME_YAML`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/config/index.html#FedEval.config.DEFAULT_RT_CFG_FILENAME_YAML "FedEval.config.DEFAULT_RT_CFG_FILENAME_YAML") | |
| [`RawConfigurationDict`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/config/index.html#FedEval.config.RawConfigurationDict "FedEval.config.RawConfigurationDict") | |
| [`ClientId`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/config/index.html#FedEval.config.ClientId "FedEval.config.ClientId") | |
FedEval.config.DEFAULT\_D\_CFG\_FILENAME\_YAML _\= '1\_data\_config.yml'_[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/config/index.html#FedEval.config.DEFAULT_D_CFG_FILENAME_YAML "Link to this definition")
FedEval.config.DEFAULT\_MDL\_CFG\_FILENAME\_YAML _\= '2\_model\_config.yml'_[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/config/index.html#FedEval.config.DEFAULT_MDL_CFG_FILENAME_YAML "Link to this definition")
FedEval.config.DEFAULT\_RT\_CFG\_FILENAME\_YAML _\= '3\_runtime\_config.yml'_[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/config/index.html#FedEval.config.DEFAULT_RT_CFG_FILENAME_YAML "Link to this definition")
_class_ FedEval.config.ClientConfigurationManagerInterface[\[source\]](https://fedeval.readthedocs.io/en/latest/_modules/FedEval/config/configuration.html#ClientConfigurationManagerInterface)
[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/config/index.html#FedEval.config.ClientConfigurationManagerInterface "Link to this definition")
Bases: `abc.ABC`
an interface of ConfigurationManager from the client side, regulating the essential functions as clients.
Raises:
**NotImplementedError** – called without implementation.
_class_ FedEval.config.ConfigurationManager(_data\_config: RawConfigurationDict \= \_DEFAULT\_D\_CFG_, _model\_config: RawConfigurationDict \= \_DEFAULT\_MDL\_CFG_, _runtime\_config: RawConfigurationDict \= \_DEFAULT\_RT\_CFG_, _thread\_safe: bool \= False_)[\[source\]](https://fedeval.readthedocs.io/en/latest/_modules/FedEval/config/configuration.html#ConfigurationManager)
[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/config/index.html#FedEval.config.ConfigurationManager "Link to this definition")
Bases: [`FedEval.config.singleton.Singleton`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/config/singleton/index.html#FedEval.config.singleton.Singleton "FedEval.config.singleton.Singleton")
, [`ConfigurationManagerInterface`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/config/index.html#FedEval.config.ConfigurationManagerInterface "FedEval.config.ConfigurationManagerInterface")
, [`ClientConfigurationManagerInterface`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/config/index.html#FedEval.config.ClientConfigurationManagerInterface "FedEval.config.ClientConfigurationManagerInterface")
, [`ServerConfigurationManagerInterface`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/config/index.html#FedEval.config.ServerConfigurationManagerInterface "FedEval.config.ServerConfigurationManagerInterface")
, `_CfgYamlInterface`, `_CfgJsonInterface`, `_CfgFileInterface`, `_RoledConfigurationInterface`
the base class of singletons. Each cls on the inheritance tree can own only one instance.
_property_ data\_unique\_id[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/config/index.html#FedEval.config.ConfigurationManager.data_unique_id "Link to this definition")
_property_ config\_unique\_id[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/config/index.html#FedEval.config.ConfigurationManager.config_unique_id "Link to this definition")
_property_ data\_dir\_name_: str_[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/config/index.html#FedEval.config.ConfigurationManager.data_dir_name "Link to this definition")
The output directory of the clients’ data.
Returns:
the name of the data directory.
Return type:
str
_property_ log\_dir\_path_: str_[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/config/index.html#FedEval.config.ConfigurationManager.log_dir_path "Link to this definition")
the path of the base of log directory.
_property_ history\_record\_path_: str_[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/config/index.html#FedEval.config.ConfigurationManager.history_record_path "Link to this definition")
the path of the history record.
_property_ job\_id_: str_[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/config/index.html#FedEval.config.ConfigurationManager.job_id "Link to this definition")
_property_ encoding_: str_[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/config/index.html#FedEval.config.ConfigurationManager.encoding "Link to this definition")
the encoding scheme during (de)serialization.
_property_ data\_config\_filename_: str_[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/config/index.html#FedEval.config.ConfigurationManager.data_config_filename "Link to this definition")
_property_ model\_config\_filename_: str_[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/config/index.html#FedEval.config.ConfigurationManager.model_config_filename "Link to this definition")
_property_ runtime\_config\_filename_: str_[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/config/index.html#FedEval.config.ConfigurationManager.runtime_config_filename "Link to this definition")
_property_ data\_config_: [\_DataConfig](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/config/configuration/index.html#FedEval.config.configuration._DataConfig "FedEval.config.configuration._DataConfig")
_[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/config/index.html#FedEval.config.ConfigurationManager.data_config "Link to this definition")
_property_ model\_config_: [\_ModelConfig](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/config/configuration/index.html#FedEval.config.configuration._ModelConfig "FedEval.config.configuration._ModelConfig")
_[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/config/index.html#FedEval.config.ConfigurationManager.model_config "Link to this definition")
_property_ runtime\_config_: [\_RuntimeConfig](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/config/configuration/index.html#FedEval.config.configuration._RuntimeConfig "FedEval.config.configuration._RuntimeConfig")
_[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/config/index.html#FedEval.config.ConfigurationManager.runtime_config "Link to this definition")
_property_ num\_of\_train\_clients\_contacted\_per\_round_: int_[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/config/index.html#FedEval.config.ConfigurationManager.num_of_train_clients_contacted_per_round "Link to this definition")
the number of clients selected to participate the main federated process in each round.
_property_ num\_of\_eval\_clients\_contacted\_per\_round_: int_[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/config/index.html#FedEval.config.ConfigurationManager.num_of_eval_clients_contacted_per_round "Link to this definition")
the number of clients selected to participate the main federated process in each round.
_property_ role_: [FedEval.config.role.Role](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/config/role/index.html#FedEval.config.role.Role "FedEval.config.role.Role")
_[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/config/index.html#FedEval.config.ConfigurationManager.role "Link to this definition")
return the role of this runtime entity.
Raises:
**AttributeError** – called without role configured.
Returns:
the role of this runtime entity.
Return type:
[Role](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/config/index.html#FedEval.config.Role "FedEval.config.Role")
\_\_init\_once\_lock[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/config/index.html#FedEval.config.ConfigurationManager.__init_once_lock "Link to this definition")
\_\_initiated _\= False_[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/config/index.html#FedEval.config.ConfigurationManager.__initiated "Link to this definition")
\_init\_file\_names(_data\_config\_filename: str \= DEFAULT\_D\_CFG\_FILENAME\_YAML_, _model\_config\_filename: str \= DEFAULT\_MDL\_CFG\_FILENAME\_YAML_, _runtime\_config\_filename: str \= DEFAULT\_RT\_CFG\_FILENAME\_YAML_) → None[\[source\]](https://fedeval.readthedocs.io/en/latest/_modules/FedEval/config/configuration.html#ConfigurationManager._init_file_names)
[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/config/index.html#FedEval.config.ConfigurationManager._init_file_names "Link to this definition")
_classmethod_ generate\_unique\_id(_data\_config: dict_, _model\_config: dict_, _runtime\_config: dict_)[\[source\]](https://fedeval.readthedocs.io/en/latest/_modules/FedEval/config/configuration.html#ConfigurationManager.generate_unique_id)
[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/config/index.html#FedEval.config.ConfigurationManager.generate_unique_id "Link to this definition")
_static_ \_get\_md5(_config\_string_)[\[source\]](https://fedeval.readthedocs.io/en/latest/_modules/FedEval/config/configuration.html#ConfigurationManager._get_md5)
[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/config/index.html#FedEval.config.ConfigurationManager._get_md5 "Link to this definition")
_static_ load\_configs(_src\_path_, _serializer: str | [\_CfgSerializer](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/config/configuration/index.html#FedEval.config.configuration._CfgSerializer "FedEval.config.configuration._CfgSerializer")
\= \_CfgSerializer.YAML_, _data\_config\_filename: str \= DEFAULT\_D\_CFG\_FILENAME\_YAML_, _model\_config\_filename: str \= DEFAULT\_MDL\_CFG\_FILENAME\_YAML_, _runtime\_config\_filename: str \= DEFAULT\_RT\_CFG\_FILENAME\_YAML_, _encoding\=\_DEFAULT\_ENCODING_) → Tuple\[RawConfigurationDict, RawConfigurationDict, RawConfigurationDict\][\[source\]](https://fedeval.readthedocs.io/en/latest/_modules/FedEval/config/configuration.html#ConfigurationManager.load_configs)
[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/config/index.html#FedEval.config.ConfigurationManager.load_configs "Link to this definition")
_static_ save\_configs(_data\_cfg: RawConfigurationDict_, _model\_cfg: RawConfigurationDict_, _runtime\_cfg: RawConfigurationDict_, _dst\_path_, _data\_config\_filename: str \= DEFAULT\_D\_CFG\_FILENAME\_YAML_, _model\_config\_filename: str \= DEFAULT\_MDL\_CFG\_FILENAME\_YAML_, _runtime\_config\_filename: str \= DEFAULT\_RT\_CFG\_FILENAME\_YAML_, _encoding\=\_DEFAULT\_ENCODING_, _serializer: str | [\_CfgSerializer](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/config/configuration/index.html#FedEval.config.configuration._CfgSerializer "FedEval.config.configuration._CfgSerializer")
\= \_CfgSerializer.YAML_)[\[source\]](https://fedeval.readthedocs.io/en/latest/_modules/FedEval/config/configuration.html#ConfigurationManager.save_configs)
[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/config/index.html#FedEval.config.ConfigurationManager.save_configs "Link to this definition")
_static_ from\_files(_src\_path: str_, _data\_config\_filename: str \= DEFAULT\_D\_CFG\_FILENAME\_YAML_, _model\_config\_filename: str \= DEFAULT\_MDL\_CFG\_FILENAME\_YAML_, _runtime\_config\_filename: str \= DEFAULT\_RT\_CFG\_FILENAME\_YAML_, _serializer: str | [\_CfgSerializer](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/config/configuration/index.html#FedEval.config.configuration._CfgSerializer "FedEval.config.configuration._CfgSerializer")
\= \_CfgSerializer.YAML_, _encoding\=\_DEFAULT\_ENCODING_)[\[source\]](https://fedeval.readthedocs.io/en/latest/_modules/FedEval/config/configuration.html#ConfigurationManager.from_files)
[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/config/index.html#FedEval.config.ConfigurationManager.from_files "Link to this definition")
to\_files(_dst\_dir\_path: str_, _serializer: str | [\_CfgSerializer](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/config/configuration/index.html#FedEval.config.configuration._CfgSerializer "FedEval.config.configuration._CfgSerializer")
\= \_CfgSerializer.YAML_, _encoding: str | None \= None_) → None[\[source\]](https://fedeval.readthedocs.io/en/latest/_modules/FedEval/config/configuration.html#ConfigurationManager.to_files)
[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/config/index.html#FedEval.config.ConfigurationManager.to_files "Link to this definition")
\_\_init\_role() → None[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/config/index.html#FedEval.config.ConfigurationManager.__init_role "Link to this definition")
_class_ FedEval.config.ConfigurationManagerInterface[\[source\]](https://fedeval.readthedocs.io/en/latest/_modules/FedEval/config/configuration.html#ConfigurationManagerInterface)
[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/config/index.html#FedEval.config.ConfigurationManagerInterface "Link to this definition")
Bases: `abc.ABC`
Helper class that provides a standard way to create an ABC using inheritance.
_abstract property_ data\_config\_filename_: str_[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/config/index.html#FedEval.config.ConfigurationManagerInterface.data_config_filename "Link to this definition")
_abstract property_ model\_config\_filename_: str_[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/config/index.html#FedEval.config.ConfigurationManagerInterface.model_config_filename "Link to this definition")
_abstract property_ runtime\_config\_filename_: str_[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/config/index.html#FedEval.config.ConfigurationManagerInterface.runtime_config_filename "Link to this definition")
_abstract property_ data\_config_: RawConfigurationDict_[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/config/index.html#FedEval.config.ConfigurationManagerInterface.data_config "Link to this definition")
_abstract property_ model\_config_: [\_ModelConfig](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/config/configuration/index.html#FedEval.config.configuration._ModelConfig "FedEval.config.configuration._ModelConfig")
_[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/config/index.html#FedEval.config.ConfigurationManagerInterface.model_config "Link to this definition")
_abstract property_ runtime\_config_: RawConfigurationDict_[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/config/index.html#FedEval.config.ConfigurationManagerInterface.runtime_config "Link to this definition")
_abstract property_ job\_id[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/config/index.html#FedEval.config.ConfigurationManagerInterface.job_id "Link to this definition")
FedEval.config.RawConfigurationDict[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/config/index.html#FedEval.config.RawConfigurationDict "Link to this definition")
_class_ FedEval.config.ServerConfigurationManagerInterface[\[source\]](https://fedeval.readthedocs.io/en/latest/_modules/FedEval/config/configuration.html#ServerConfigurationManagerInterface)
[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/config/index.html#FedEval.config.ServerConfigurationManagerInterface "Link to this definition")
Bases: `abc.ABC`
an interface of ConfigurationManager from the central server side, regulating the essential functions as clients.
Raises:
**NotImplementedError** – called without implementation.
_abstract property_ num\_of\_train\_clients\_contacted\_per\_round_: int_[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/config/index.html#FedEval.config.ServerConfigurationManagerInterface.num_of_train_clients_contacted_per_round "Link to this definition")
_class_ FedEval.config.ServerFlaskInterface[\[source\]](https://fedeval.readthedocs.io/en/latest/_modules/FedEval/config/service_interface.html#ServerFlaskInterface)
[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/config/index.html#FedEval.config.ServerFlaskInterface "Link to this definition")
Bases: `enum.Enum`
Generic enumeration.
Derive from this class to define new enumerations.
Dashboard _\= '/dashboard'_[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/config/index.html#FedEval.config.ServerFlaskInterface.Dashboard "Link to this definition")
Status _\= '/status'_[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/config/index.html#FedEval.config.ServerFlaskInterface.Status "Link to this definition")
DownloadPattern _\= '/download/{}'_[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/config/index.html#FedEval.config.ServerFlaskInterface.DownloadPattern "Link to this definition")
_class_ FedEval.config.Role[\[source\]](https://fedeval.readthedocs.io/en/latest/_modules/FedEval/config/role.html#Role)
[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/config/index.html#FedEval.config.Role "Link to this definition")
Bases: `enum.Enum`
Generic enumeration.
Derive from this class to define new enumerations.
Server _\= 'server'_[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/config/index.html#FedEval.config.Role.Server "Link to this definition")
Client _\= 'client'_[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/config/index.html#FedEval.config.Role.Client "Link to this definition")
FedEval.config.ClientId[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/config/index.html#FedEval.config.ClientId "Link to this definition")
---
# 5.1.1.2. FedEval.communicaiton — FedEval documentation
* [](https://fedeval.readthedocs.io/en/latest/index.html)
* [5\. API Reference](https://fedeval.readthedocs.io/en/latest/autoapi/index.html)
* [5.1. `FedEval`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/index.html)
* 5.1.1.2. `FedEval.communicaiton`
* [Edit on GitHub](https://github.com/Di-Chai/FedEval/blob/master/docs/autoapi/FedEval/communicaiton/index.rst)
* * *
5.1.1.2. [`FedEval.communicaiton`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/communicaiton/index.html#module-FedEval.communicaiton "FedEval.communicaiton")
[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/communicaiton/index.html#module-FedEval.communicaiton "Link to this heading")
======================================================================================================================================================================================================================================================================================================================
5.1.1.2.1. Submodules[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/communicaiton/index.html#submodules "Link to this heading")
----------------------------------------------------------------------------------------------------------------------------------------------
* [5.1.1.2.1.1. `FedEval.communicaiton.comm_pb2`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/communicaiton/comm_pb2/index.html)
* [5.1.1.2.1.2. `FedEval.communicaiton.comm_pb2_grpc`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/communicaiton/comm_pb2_grpc/index.html)
* [5.1.1.2.1.3. `FedEval.communicaiton.communicator`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/communicaiton/communicator/index.html)
* [5.1.1.2.1.4. `FedEval.communicaiton.events`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/communicaiton/events/index.html)
* [5.1.1.2.1.5. `FedEval.communicaiton.flask_communicator`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/communicaiton/flask_communicator/index.html)
* [5.1.1.2.1.6. `FedEval.communicaiton.grpc_communicator`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/communicaiton/grpc_communicator/index.html)
* [5.1.1.2.1.7. `FedEval.communicaiton.model_weights_io`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/communicaiton/model_weights_io/index.html)
* [5.1.1.2.1.8. `FedEval.communicaiton.preset`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/communicaiton/preset/index.html)
5.1.1.2.2. Package Contents[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/communicaiton/index.html#package-contents "Link to this heading")
----------------------------------------------------------------------------------------------------------------------------------------------------------
### 5.1.1.2.2.1. Classes[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/communicaiton/index.html#classes "Link to this heading")
| | |
| --- | --- |
| [`ConfigurationManager`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/communicaiton/index.html#FedEval.communicaiton.ConfigurationManager "FedEval.communicaiton.ConfigurationManager") | the base class of singletons. |
| [`ClientCommunicator`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/communicaiton/index.html#FedEval.communicaiton.ClientCommunicator "FedEval.communicaiton.ClientCommunicator") | Helper class that provides a standard way to create an ABC using |
| [`ServerCommunicator`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/communicaiton/index.html#FedEval.communicaiton.ServerCommunicator "FedEval.communicaiton.ServerCommunicator") | Helper class that provides a standard way to create an ABC using |
| [`ClientEvent`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/communicaiton/index.html#FedEval.communicaiton.ClientEvent "FedEval.communicaiton.ClientEvent") | client-side SocketIO event handles' name. |
| [`ConnectionEvent`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/communicaiton/index.html#FedEval.communicaiton.ConnectionEvent "FedEval.communicaiton.ConnectionEvent") | basic SocketIO life-cycle event names. |
| [`ServerEvent`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/communicaiton/index.html#FedEval.communicaiton.ServerEvent "FedEval.communicaiton.ServerEvent") | server-side SocketIO event handles' name. |
| [`ClientFlaskCommunicator`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/communicaiton/index.html#FedEval.communicaiton.ClientFlaskCommunicator "FedEval.communicaiton.ClientFlaskCommunicator") | Helper class that provides a standard way to create an ABC using |
| [`ServerFlaskCommunicator`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/communicaiton/index.html#FedEval.communicaiton.ServerFlaskCommunicator "FedEval.communicaiton.ServerFlaskCommunicator") | Helper class that provides a standard way to create an ABC using |
| [`ClientGrpcCommunicator`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/communicaiton/index.html#FedEval.communicaiton.ClientGrpcCommunicator "FedEval.communicaiton.ClientGrpcCommunicator") | Helper class that provides a standard way to create an ABC using |
| [`ServerGrpcCommunicator`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/communicaiton/index.html#FedEval.communicaiton.ServerGrpcCommunicator "FedEval.communicaiton.ServerGrpcCommunicator") | Helper class that provides a standard way to create an ABC using |
| [`ModelWeightsHandler`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/communicaiton/index.html#FedEval.communicaiton.ModelWeightsHandler "FedEval.communicaiton.ModelWeightsHandler") | |
| [`ModelWeightsIoInterface`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/communicaiton/index.html#FedEval.communicaiton.ModelWeightsIoInterface "FedEval.communicaiton.ModelWeightsIoInterface") | |
| [`CommunicationMethod`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/communicaiton/index.html#FedEval.communicaiton.CommunicationMethod "FedEval.communicaiton.CommunicationMethod") | Generic enumeration. |
### 5.1.1.2.2.2. Functions[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/communicaiton/index.html#functions "Link to this heading")
| | |
| --- | --- |
| [`get_client_communicator`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/communicaiton/index.html#FedEval.communicaiton.get_client_communicator "FedEval.communicaiton.get_client_communicator")
(→ communicator.ClientCommunicator) | |
| [`get_server_communicator`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/communicaiton/index.html#FedEval.communicaiton.get_server_communicator "FedEval.communicaiton.get_server_communicator")
(→ communicator.ServerCommunicator) | |
### 5.1.1.2.2.3. Attributes[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/communicaiton/index.html#attributes "Link to this heading")
| | |
| --- | --- |
| [`Sid`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/communicaiton/index.html#FedEval.communicaiton.Sid "FedEval.communicaiton.Sid") | |
| [`server_best_weight_filename`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/communicaiton/index.html#FedEval.communicaiton.server_best_weight_filename "FedEval.communicaiton.server_best_weight_filename") | |
| [`weights_filename_pattern`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/communicaiton/index.html#FedEval.communicaiton.weights_filename_pattern "FedEval.communicaiton.weights_filename_pattern") | |
_class_ FedEval.communicaiton.ConfigurationManager(_data\_config: RawConfigurationDict \= \_DEFAULT\_D\_CFG_, _model\_config: RawConfigurationDict \= \_DEFAULT\_MDL\_CFG_, _runtime\_config: RawConfigurationDict \= \_DEFAULT\_RT\_CFG_, _thread\_safe: bool \= False_)[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/communicaiton/index.html#FedEval.communicaiton.ConfigurationManager "Link to this definition")
Bases: [`FedEval.config.singleton.Singleton`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/config/singleton/index.html#FedEval.config.singleton.Singleton "FedEval.config.singleton.Singleton")
, `ConfigurationManagerInterface`, `ClientConfigurationManagerInterface`, `ServerConfigurationManagerInterface`, `_CfgYamlInterface`, `_CfgJsonInterface`, `_CfgFileInterface`, `_RoledConfigurationInterface`
the base class of singletons. Each cls on the inheritance tree can own only one instance.
_property_ data\_unique\_id[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/communicaiton/index.html#FedEval.communicaiton.ConfigurationManager.data_unique_id "Link to this definition")
_property_ config\_unique\_id[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/communicaiton/index.html#FedEval.communicaiton.ConfigurationManager.config_unique_id "Link to this definition")
_property_ data\_dir\_name_: str_[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/communicaiton/index.html#FedEval.communicaiton.ConfigurationManager.data_dir_name "Link to this definition")
The output directory of the clients’ data.
Returns:
the name of the data directory.
Return type:
str
_property_ log\_dir\_path_: str_[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/communicaiton/index.html#FedEval.communicaiton.ConfigurationManager.log_dir_path "Link to this definition")
the path of the base of log directory.
_property_ history\_record\_path_: str_[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/communicaiton/index.html#FedEval.communicaiton.ConfigurationManager.history_record_path "Link to this definition")
the path of the history record.
_property_ job\_id_: str_[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/communicaiton/index.html#FedEval.communicaiton.ConfigurationManager.job_id "Link to this definition")
_property_ encoding_: str_[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/communicaiton/index.html#FedEval.communicaiton.ConfigurationManager.encoding "Link to this definition")
the encoding scheme during (de)serialization.
_property_ data\_config\_filename_: str_[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/communicaiton/index.html#FedEval.communicaiton.ConfigurationManager.data_config_filename "Link to this definition")
_property_ model\_config\_filename_: str_[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/communicaiton/index.html#FedEval.communicaiton.ConfigurationManager.model_config_filename "Link to this definition")
_property_ runtime\_config\_filename_: str_[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/communicaiton/index.html#FedEval.communicaiton.ConfigurationManager.runtime_config_filename "Link to this definition")
_property_ data\_config_: [\_DataConfig](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/config/configuration/index.html#FedEval.config.configuration._DataConfig "FedEval.config.configuration._DataConfig")
_[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/communicaiton/index.html#FedEval.communicaiton.ConfigurationManager.data_config "Link to this definition")
_property_ model\_config_: [\_ModelConfig](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/config/configuration/index.html#FedEval.config.configuration._ModelConfig "FedEval.config.configuration._ModelConfig")
_[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/communicaiton/index.html#FedEval.communicaiton.ConfigurationManager.model_config "Link to this definition")
_property_ runtime\_config_: [\_RuntimeConfig](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/config/configuration/index.html#FedEval.config.configuration._RuntimeConfig "FedEval.config.configuration._RuntimeConfig")
_[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/communicaiton/index.html#FedEval.communicaiton.ConfigurationManager.runtime_config "Link to this definition")
_property_ num\_of\_train\_clients\_contacted\_per\_round_: int_[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/communicaiton/index.html#FedEval.communicaiton.ConfigurationManager.num_of_train_clients_contacted_per_round "Link to this definition")
the number of clients selected to participate the main federated process in each round.
_property_ num\_of\_eval\_clients\_contacted\_per\_round_: int_[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/communicaiton/index.html#FedEval.communicaiton.ConfigurationManager.num_of_eval_clients_contacted_per_round "Link to this definition")
the number of clients selected to participate the main federated process in each round.
_property_ role_: [FedEval.config.role.Role](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/config/role/index.html#FedEval.config.role.Role "FedEval.config.role.Role")
_[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/communicaiton/index.html#FedEval.communicaiton.ConfigurationManager.role "Link to this definition")
return the role of this runtime entity.
Raises:
**AttributeError** – called without role configured.
Returns:
the role of this runtime entity.
Return type:
[Role](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/config/index.html#FedEval.config.Role "FedEval.config.Role")
\_\_init\_once\_lock[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/communicaiton/index.html#FedEval.communicaiton.ConfigurationManager.__init_once_lock "Link to this definition")
\_\_initiated _\= False_[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/communicaiton/index.html#FedEval.communicaiton.ConfigurationManager.__initiated "Link to this definition")
\_init\_file\_names(_data\_config\_filename: str \= DEFAULT\_D\_CFG\_FILENAME\_YAML_, _model\_config\_filename: str \= DEFAULT\_MDL\_CFG\_FILENAME\_YAML_, _runtime\_config\_filename: str \= DEFAULT\_RT\_CFG\_FILENAME\_YAML_) → None[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/communicaiton/index.html#FedEval.communicaiton.ConfigurationManager._init_file_names "Link to this definition")
_classmethod_ generate\_unique\_id(_data\_config: dict_, _model\_config: dict_, _runtime\_config: dict_)[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/communicaiton/index.html#FedEval.communicaiton.ConfigurationManager.generate_unique_id "Link to this definition")
_static_ \_get\_md5(_config\_string_)[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/communicaiton/index.html#FedEval.communicaiton.ConfigurationManager._get_md5 "Link to this definition")
_static_ load\_configs(_src\_path_, _serializer: str | [\_CfgSerializer](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/config/configuration/index.html#FedEval.config.configuration._CfgSerializer "FedEval.config.configuration._CfgSerializer")
\= \_CfgSerializer.YAML_, _data\_config\_filename: str \= DEFAULT\_D\_CFG\_FILENAME\_YAML_, _model\_config\_filename: str \= DEFAULT\_MDL\_CFG\_FILENAME\_YAML_, _runtime\_config\_filename: str \= DEFAULT\_RT\_CFG\_FILENAME\_YAML_, _encoding\=\_DEFAULT\_ENCODING_) → Tuple\[RawConfigurationDict, RawConfigurationDict, RawConfigurationDict\][](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/communicaiton/index.html#FedEval.communicaiton.ConfigurationManager.load_configs "Link to this definition")
_static_ save\_configs(_data\_cfg: RawConfigurationDict_, _model\_cfg: RawConfigurationDict_, _runtime\_cfg: RawConfigurationDict_, _dst\_path_, _data\_config\_filename: str \= DEFAULT\_D\_CFG\_FILENAME\_YAML_, _model\_config\_filename: str \= DEFAULT\_MDL\_CFG\_FILENAME\_YAML_, _runtime\_config\_filename: str \= DEFAULT\_RT\_CFG\_FILENAME\_YAML_, _encoding\=\_DEFAULT\_ENCODING_, _serializer: str | [\_CfgSerializer](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/config/configuration/index.html#FedEval.config.configuration._CfgSerializer "FedEval.config.configuration._CfgSerializer")
\= \_CfgSerializer.YAML_)[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/communicaiton/index.html#FedEval.communicaiton.ConfigurationManager.save_configs "Link to this definition")
_static_ from\_files(_src\_path: str_, _data\_config\_filename: str \= DEFAULT\_D\_CFG\_FILENAME\_YAML_, _model\_config\_filename: str \= DEFAULT\_MDL\_CFG\_FILENAME\_YAML_, _runtime\_config\_filename: str \= DEFAULT\_RT\_CFG\_FILENAME\_YAML_, _serializer: str | [\_CfgSerializer](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/config/configuration/index.html#FedEval.config.configuration._CfgSerializer "FedEval.config.configuration._CfgSerializer")
\= \_CfgSerializer.YAML_, _encoding\=\_DEFAULT\_ENCODING_)[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/communicaiton/index.html#FedEval.communicaiton.ConfigurationManager.from_files "Link to this definition")
to\_files(_dst\_dir\_path: str_, _serializer: str | [\_CfgSerializer](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/config/configuration/index.html#FedEval.config.configuration._CfgSerializer "FedEval.config.configuration._CfgSerializer")
\= \_CfgSerializer.YAML_, _encoding: str | None \= None_) → None[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/communicaiton/index.html#FedEval.communicaiton.ConfigurationManager.to_files "Link to this definition")
\_\_init\_role() → None[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/communicaiton/index.html#FedEval.communicaiton.ConfigurationManager.__init_role "Link to this definition")
_class_ FedEval.communicaiton.ClientCommunicator[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/communicaiton/index.html#FedEval.communicaiton.ClientCommunicator "Link to this definition")
Bases: `Communicatior`
Helper class that provides a standard way to create an ABC using inheritance.
_abstract_ on(_event: [FedEval.communicaiton.events.ClientEvent](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/communicaiton/events/index.html#FedEval.communicaiton.events.ClientEvent "FedEval.communicaiton.events.ClientEvent")
_, _\*on\_args_, _\*\*on\_kwargs_)[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/communicaiton/index.html#FedEval.communicaiton.ClientCommunicator.on "Link to this definition")
_abstract_ invoke(_event: [FedEval.communicaiton.events.ServerEvent](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/communicaiton/events/index.html#FedEval.communicaiton.events.ServerEvent "FedEval.communicaiton.events.ServerEvent")
_, _\*args_, _\*\*kwargs_)[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/communicaiton/index.html#FedEval.communicaiton.ClientCommunicator.invoke "Link to this definition")
_abstract_ wait(_\*\*kw_) → None[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/communicaiton/index.html#FedEval.communicaiton.ClientCommunicator.wait "Link to this definition")
_class_ FedEval.communicaiton.ServerCommunicator[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/communicaiton/index.html#FedEval.communicaiton.ServerCommunicator "Link to this definition")
Bases: `Communicatior`
Helper class that provides a standard way to create an ABC using inheritance.
_property_ ready\_client\_ids_: Iterable\[FedEval.config.role.ClientId\]_[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/communicaiton/index.html#FedEval.communicaiton.ServerCommunicator.ready_client_ids "Link to this definition")
_abstract_ handle\_disconnection() → Iterable\[FedEval.config.role.ClientId\][](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/communicaiton/index.html#FedEval.communicaiton.ServerCommunicator.handle_disconnection "Link to this definition")
\_handle\_disconnection(_comm\_id: FedEval.role.container.CommunicationId_) → Iterable\[FedEval.config.role.ClientId\][](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/communicaiton/index.html#FedEval.communicaiton.ServerCommunicator._handle_disconnection "Link to this definition")
_abstract_ handle\_reconnection() → Iterable\[FedEval.config.role.ClientId\][](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/communicaiton/index.html#FedEval.communicaiton.ServerCommunicator.handle_reconnection "Link to this definition")
\_handle\_reconnection(_comm\_id: FedEval.role.container.CommunicationId_) → Iterable\[FedEval.config.role.ClientId\][](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/communicaiton/index.html#FedEval.communicaiton.ServerCommunicator._handle_reconnection "Link to this definition")
_abstract_ activate(_node\_id: FedEval.role.container.NodeId_, _client\_ids: Iterable\[FedEval.config.role.ClientId\]_) → None[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/communicaiton/index.html#FedEval.communicaiton.ServerCommunicator.activate "Link to this definition")
\_activate(_node\_id: FedEval.role.container.NodeId_, _comm\_id: FedEval.role.container.CommunicationId_, _client\_ids: Iterable\[FedEval.config.role.ClientId\]_) → None[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/communicaiton/index.html#FedEval.communicaiton.ServerCommunicator._activate "Link to this definition")
_abstract_ invoke(_event: [FedEval.communicaiton.events.ClientEvent](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/communicaiton/events/index.html#FedEval.communicaiton.events.ClientEvent "FedEval.communicaiton.events.ClientEvent")
_, _\*args_, _callee: FedEval.config.role.ClientId | None \= None_, _\*\*kwargs_)[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/communicaiton/index.html#FedEval.communicaiton.ServerCommunicator.invoke "Link to this definition")
_abstract_ invoke\_all(_event: [FedEval.communicaiton.events.ClientEvent](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/communicaiton/events/index.html#FedEval.communicaiton.events.ClientEvent "FedEval.communicaiton.events.ClientEvent")
_, _payload: Dict\[str, Any\] | None \= None_, _\*args_, _callees: Iterable\[FedEval.config.role.ClientId\] | None \= None_, _\*\*kwargs_)[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/communicaiton/index.html#FedEval.communicaiton.ServerCommunicator.invoke_all "Link to this definition")
_abstract_ on(_event: [FedEval.communicaiton.events.ClientEvent](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/communicaiton/events/index.html#FedEval.communicaiton.events.ClientEvent "FedEval.communicaiton.events.ClientEvent")
_) → Callable\[\[Callable\], Any\][](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/communicaiton/index.html#FedEval.communicaiton.ServerCommunicator.on "Link to this definition")
_abstract_ route(_rule: str_, _\*\*options: Any_)[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/communicaiton/index.html#FedEval.communicaiton.ServerCommunicator.route "Link to this definition")
_abstract_ run\_server() → None[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/communicaiton/index.html#FedEval.communicaiton.ServerCommunicator.run_server "Link to this definition")
_class_ FedEval.communicaiton.ClientEvent[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/communicaiton/index.html#FedEval.communicaiton.ClientEvent "Link to this definition")
Bases: `enum.Enum`
client-side SocketIO event handles’ name.
Init _\= 'init'_[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/communicaiton/index.html#FedEval.communicaiton.ClientEvent.Init "Link to this definition")
RequestUpdate _\= 'request\_update'_[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/communicaiton/index.html#FedEval.communicaiton.ClientEvent.RequestUpdate "Link to this definition")
RequestEvaluate _\= 'request\_evaluate'_[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/communicaiton/index.html#FedEval.communicaiton.ClientEvent.RequestEvaluate "Link to this definition")
Stop _\= 'stop'_[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/communicaiton/index.html#FedEval.communicaiton.ClientEvent.Stop "Link to this definition")
_class_ FedEval.communicaiton.ConnectionEvent[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/communicaiton/index.html#FedEval.communicaiton.ConnectionEvent "Link to this definition")
Bases: `enum.Enum`
basic SocketIO life-cycle event names.
Connect _\= 'connect'_[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/communicaiton/index.html#FedEval.communicaiton.ConnectionEvent.Connect "Link to this definition")
Disconnect _\= 'disconnect'_[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/communicaiton/index.html#FedEval.communicaiton.ConnectionEvent.Disconnect "Link to this definition")
Reconnect _\= 'reconnect'_[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/communicaiton/index.html#FedEval.communicaiton.ConnectionEvent.Reconnect "Link to this definition")
_class_ FedEval.communicaiton.ServerEvent[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/communicaiton/index.html#FedEval.communicaiton.ServerEvent "Link to this definition")
Bases: `enum.Enum`
server-side SocketIO event handles’ name.
WakeUp _\= 'client\_wake\_up'_[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/communicaiton/index.html#FedEval.communicaiton.ServerEvent.WakeUp "Link to this definition")
Ready _\= 'client\_ready'_[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/communicaiton/index.html#FedEval.communicaiton.ServerEvent.Ready "Link to this definition")
ResponseUpdate _\= 'client\_update'_[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/communicaiton/index.html#FedEval.communicaiton.ServerEvent.ResponseUpdate "Link to this definition")
ResponseEvaluate _\= 'client\_evaluate'_[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/communicaiton/index.html#FedEval.communicaiton.ServerEvent.ResponseEvaluate "Link to this definition")
_class_ FedEval.communicaiton.ClientFlaskCommunicator[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/communicaiton/index.html#FedEval.communicaiton.ClientFlaskCommunicator "Link to this definition")
Bases: [`FedEval.communicaiton.communicator.ClientCommunicator`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/communicaiton/communicator/index.html#FedEval.communicaiton.communicator.ClientCommunicator "FedEval.communicaiton.communicator.ClientCommunicator")
Helper class that provides a standard way to create an ABC using inheritance.
on(_event: [FedEval.communicaiton.events.ClientEvent](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/communicaiton/events/index.html#FedEval.communicaiton.events.ClientEvent "FedEval.communicaiton.events.ClientEvent")
_, _\*on\_args_, _\*\*on\_kwargs_)[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/communicaiton/index.html#FedEval.communicaiton.ClientFlaskCommunicator.on "Link to this definition")
invoke(_event: [FedEval.communicaiton.events.ServerEvent](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/communicaiton/events/index.html#FedEval.communicaiton.events.ServerEvent "FedEval.communicaiton.events.ServerEvent")
_, _\*args_, _\*\*kwargs_)[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/communicaiton/index.html#FedEval.communicaiton.ClientFlaskCommunicator.invoke "Link to this definition")
wait(_\*\*kw_) → None[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/communicaiton/index.html#FedEval.communicaiton.ClientFlaskCommunicator.wait "Link to this definition")
_class_ FedEval.communicaiton.ServerFlaskCommunicator[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/communicaiton/index.html#FedEval.communicaiton.ServerFlaskCommunicator "Link to this definition")
Bases: [`FedEval.communicaiton.communicator.ServerCommunicator`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/communicaiton/communicator/index.html#FedEval.communicaiton.communicator.ServerCommunicator "FedEval.communicaiton.communicator.ServerCommunicator")
Helper class that provides a standard way to create an ABC using inheritance.
on(_event: [FedEval.communicaiton.events.ClientEvent](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/communicaiton/events/index.html#FedEval.communicaiton.events.ClientEvent "FedEval.communicaiton.events.ClientEvent")
_) → Callable\[\[Callable\], Any\][](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/communicaiton/index.html#FedEval.communicaiton.ServerFlaskCommunicator.on "Link to this definition")
route(_rule: str_, _\*\*options: Any_)[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/communicaiton/index.html#FedEval.communicaiton.ServerFlaskCommunicator.route "Link to this definition")
invoke(_event: [FedEval.communicaiton.events.ClientEvent](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/communicaiton/events/index.html#FedEval.communicaiton.events.ClientEvent "FedEval.communicaiton.events.ClientEvent")
_, _\*args_, _callee: FedEval.config.ClientId | None \= None_, _\*\*kwargs_)[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/communicaiton/index.html#FedEval.communicaiton.ServerFlaskCommunicator.invoke "Link to this definition")
invoke\_all(_event: [FedEval.communicaiton.events.ClientEvent](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/communicaiton/events/index.html#FedEval.communicaiton.events.ClientEvent "FedEval.communicaiton.events.ClientEvent")
_, _payload: Dict\[str, Any\] | None \= None_, _\*args_, _callees: Iterable\[FedEval.config.ClientId\] | None \= None_, _\*\*kwargs_)[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/communicaiton/index.html#FedEval.communicaiton.ServerFlaskCommunicator.invoke_all "Link to this definition")
run\_server() → None[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/communicaiton/index.html#FedEval.communicaiton.ServerFlaskCommunicator.run_server "Link to this definition")
handle\_disconnection() → Iterable\[FedEval.config.ClientId\][](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/communicaiton/index.html#FedEval.communicaiton.ServerFlaskCommunicator.handle_disconnection "Link to this definition")
handle\_reconnection() → Iterable\[FedEval.config.ClientId\][](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/communicaiton/index.html#FedEval.communicaiton.ServerFlaskCommunicator.handle_reconnection "Link to this definition")
activate(_node\_id: FedEval.role.container.NodeId_, _client\_ids: Iterable\[FedEval.config.ClientId\]_) → None[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/communicaiton/index.html#FedEval.communicaiton.ServerFlaskCommunicator.activate "Link to this definition")
FedEval.communicaiton.Sid[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/communicaiton/index.html#FedEval.communicaiton.Sid "Link to this definition")
_class_ FedEval.communicaiton.ClientGrpcCommunicator[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/communicaiton/index.html#FedEval.communicaiton.ClientGrpcCommunicator "Link to this definition")
Bases: [`FedEval.communicaiton.communicator.ClientCommunicator`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/communicaiton/communicator/index.html#FedEval.communicaiton.communicator.ClientCommunicator "FedEval.communicaiton.communicator.ClientCommunicator")
Helper class that provides a standard way to create an ABC using inheritance.
\_on(_event: [FedEval.communicaiton.events.ClientEvent](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/communicaiton/events/index.html#FedEval.communicaiton.events.ClientEvent "FedEval.communicaiton.events.ClientEvent")
_, _handler: Callable_) → None[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/communicaiton/index.html#FedEval.communicaiton.ClientGrpcCommunicator._on "Link to this definition")
\_has\_handler(_event: [FedEval.communicaiton.events.ClientEvent](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/communicaiton/events/index.html#FedEval.communicaiton.events.ClientEvent "FedEval.communicaiton.events.ClientEvent")
_) → bool[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/communicaiton/index.html#FedEval.communicaiton.ClientGrpcCommunicator._has_handler "Link to this definition")
\_check\_handler\_registration(_event: [FedEval.communicaiton.events.ClientEvent](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/communicaiton/events/index.html#FedEval.communicaiton.events.ClientEvent "FedEval.communicaiton.events.ClientEvent")
_) → None[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/communicaiton/index.html#FedEval.communicaiton.ClientGrpcCommunicator._check_handler_registration "Link to this definition")
on(_event: [FedEval.communicaiton.events.ClientEvent](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/communicaiton/events/index.html#FedEval.communicaiton.events.ClientEvent "FedEval.communicaiton.events.ClientEvent")
_, _\*on\_args_, _\*\*on\_kwargs_)[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/communicaiton/index.html#FedEval.communicaiton.ClientGrpcCommunicator.on "Link to this definition")
invoke(_event: [FedEval.communicaiton.events.ServerEvent](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/communicaiton/events/index.html#FedEval.communicaiton.events.ServerEvent "FedEval.communicaiton.events.ServerEvent")
_, _\*args_, _\*\*kwargs_)[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/communicaiton/index.html#FedEval.communicaiton.ClientGrpcCommunicator.invoke "Link to this definition")
\_invokation\_generator()[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/communicaiton/index.html#FedEval.communicaiton.ClientGrpcCommunicator._invokation_generator "Link to this definition")
wait(_\*\*kw_) → None[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/communicaiton/index.html#FedEval.communicaiton.ClientGrpcCommunicator.wait "Link to this definition")
_class_ FedEval.communicaiton.ServerGrpcCommunicator[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/communicaiton/index.html#FedEval.communicaiton.ServerGrpcCommunicator "Link to this definition")
Bases: [`FedEval.communicaiton.communicator.ServerCommunicator`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/communicaiton/communicator/index.html#FedEval.communicaiton.communicator.ServerCommunicator "FedEval.communicaiton.communicator.ServerCommunicator")
Helper class that provides a standard way to create an ABC using inheritance.
handle\_disconnection() → Iterable\[FedEval.config.role.ClientId\][](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/communicaiton/index.html#FedEval.communicaiton.ServerGrpcCommunicator.handle_disconnection "Link to this definition")
handle\_reconnection() → Iterable\[FedEval.config.role.ClientId\][](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/communicaiton/index.html#FedEval.communicaiton.ServerGrpcCommunicator.handle_reconnection "Link to this definition")
activate(_node\_id: FedEval.role.container.NodeId_, _client\_ids: Iterable\[FedEval.config.role.ClientId\]_) → None[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/communicaiton/index.html#FedEval.communicaiton.ServerGrpcCommunicator.activate "Link to this definition")
invoke(_event: [FedEval.communicaiton.events.ClientEvent](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/communicaiton/events/index.html#FedEval.communicaiton.events.ClientEvent "FedEval.communicaiton.events.ClientEvent")
_, _\*args_, _callee: FedEval.config.role.ClientId | None \= None_, _\*\*kwargs_)[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/communicaiton/index.html#FedEval.communicaiton.ServerGrpcCommunicator.invoke "Link to this definition")
invoke\_all(_event: [FedEval.communicaiton.events.ClientEvent](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/communicaiton/events/index.html#FedEval.communicaiton.events.ClientEvent "FedEval.communicaiton.events.ClientEvent")
_, _payload: Dict\[str, Any\] | None \= None_, _\*args_, _callees: Iterable\[FedEval.config.role.ClientId\] | None \= None_, _\*\*kwargs_)[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/communicaiton/index.html#FedEval.communicaiton.ServerGrpcCommunicator.invoke_all "Link to this definition")
on(_event: [FedEval.communicaiton.events.ClientEvent](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/communicaiton/events/index.html#FedEval.communicaiton.events.ClientEvent "FedEval.communicaiton.events.ClientEvent")
_) → Callable\[\[Callable\], Any\][](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/communicaiton/index.html#FedEval.communicaiton.ServerGrpcCommunicator.on "Link to this definition")
route(_rule: str_, _\*\*options: Any_)[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/communicaiton/index.html#FedEval.communicaiton.ServerGrpcCommunicator.route "Link to this definition")
run\_server() → None[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/communicaiton/index.html#FedEval.communicaiton.ServerGrpcCommunicator.run_server "Link to this definition")
_class_ FedEval.communicaiton.ModelWeightsHandler(_download\_url\_pattern: str_)[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/communicaiton/index.html#FedEval.communicaiton.ModelWeightsHandler "Link to this definition")
Bases: [`ModelWeightsIoInterface`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/communicaiton/index.html#FedEval.communicaiton.ModelWeightsIoInterface "FedEval.communicaiton.ModelWeightsIoInterface")
fetch\_params(_file\_location: str_)[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/communicaiton/index.html#FedEval.communicaiton.ModelWeightsHandler.fetch_params "Link to this definition")
_class_ FedEval.communicaiton.ModelWeightsIoInterface[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/communicaiton/index.html#FedEval.communicaiton.ModelWeightsIoInterface "Link to this definition")
_abstract_ fetch\_params(_filename: str_)[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/communicaiton/index.html#FedEval.communicaiton.ModelWeightsIoInterface.fetch_params "Link to this definition")
FedEval.communicaiton.server\_best\_weight\_filename _\= 'best\_model.pkl'_[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/communicaiton/index.html#FedEval.communicaiton.server_best_weight_filename "Link to this definition")
FedEval.communicaiton.weights\_filename\_pattern _\= 'model\_{}.pkl'_[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/communicaiton/index.html#FedEval.communicaiton.weights_filename_pattern "Link to this definition")
_class_ FedEval.communicaiton.CommunicationMethod[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/communicaiton/index.html#FedEval.communicaiton.CommunicationMethod "Link to this definition")
Bases: `enum.Enum`
Generic enumeration.
Derive from this class to define new enumerations.
gRPC _\= 'gRPC'_[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/communicaiton/index.html#FedEval.communicaiton.CommunicationMethod.gRPC "Link to this definition")
SocketIO _\= 'SocketIO'_[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/communicaiton/index.html#FedEval.communicaiton.CommunicationMethod.SocketIO "Link to this definition")
FedEval.communicaiton.get\_client\_communicator() → [communicator.ClientCommunicator](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/communicaiton/communicator/index.html#FedEval.communicaiton.communicator.ClientCommunicator "FedEval.communicaiton.communicator.ClientCommunicator")
[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/communicaiton/index.html#FedEval.communicaiton.get_client_communicator "Link to this definition")
FedEval.communicaiton.get\_server\_communicator() → [communicator.ServerCommunicator](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/communicaiton/communicator/index.html#FedEval.communicaiton.communicator.ServerCommunicator "FedEval.communicaiton.communicator.ServerCommunicator")
[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/communicaiton/index.html#FedEval.communicaiton.get_server_communicator "Link to this definition")
---
# 5.1.1.9. FedEval.utils — FedEval documentation
* [](https://fedeval.readthedocs.io/en/latest/index.html)
* [5\. API Reference](https://fedeval.readthedocs.io/en/latest/autoapi/index.html)
* [5.1. `FedEval`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/index.html)
* 5.1.1.9. `FedEval.utils`
* [Edit on GitHub](https://github.com/Di-Chai/FedEval/blob/master/docs/autoapi/FedEval/utils/index.rst)
* * *
5.1.1.9. [`FedEval.utils`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/utils/index.html#module-FedEval.utils "FedEval.utils")
[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/utils/index.html#module-FedEval.utils "Link to this heading")
======================================================================================================================================================================================================================================================================
5.1.1.9.1. Submodules[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/utils/index.html#submodules "Link to this heading")
--------------------------------------------------------------------------------------------------------------------------------------
* [5.1.1.9.1.1. `FedEval.utils.dbapi`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/utils/dbapi/index.html)
* [5.1.1.9.1.2. `FedEval.utils.log_analysis`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/utils/log_analysis/index.html)
* [5.1.1.9.1.3. `FedEval.utils.multi_threads`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/utils/multi_threads/index.html)
* [5.1.1.9.1.4. `FedEval.utils.parameter_parser`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/utils/parameter_parser/index.html)
* [5.1.1.9.1.5. `FedEval.utils.utils`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/utils/utils/index.html)
5.1.1.9.2. Package Contents[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/utils/index.html#package-contents "Link to this heading")
--------------------------------------------------------------------------------------------------------------------------------------------------
### 5.1.1.9.2.1. Classes[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/utils/index.html#classes "Link to this heading")
| | |
| --- | --- |
| [`ParamParser`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/utils/index.html#FedEval.utils.ParamParser "FedEval.utils.ParamParser") | an implentation of ParamParserInterface. |
| [`ParamParserInterface`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/utils/index.html#FedEval.utils.ParamParserInterface "FedEval.utils.ParamParserInterface") | Abstract class of ParamParser, containing basic params parse functions. |
| [`LogAnalysis`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/utils/index.html#FedEval.utils.LogAnalysis "FedEval.utils.LogAnalysis") | |
| [`History`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/utils/index.html#FedEval.utils.History "FedEval.utils.History") | |
### 5.1.1.9.2.2. Functions[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/utils/index.html#functions "Link to this heading")
| | |
| --- | --- |
| [`pickle_string_to_obj`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/utils/index.html#FedEval.utils.pickle_string_to_obj "FedEval.utils.pickle_string_to_obj")
(s) | |
| [`obj_to_pickle_string`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/utils/index.html#FedEval.utils.obj_to_pickle_string "FedEval.utils.obj_to_pickle_string")
(x\[, file\_path\]) | |
| [`list_tree`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/utils/index.html#FedEval.utils.list_tree "FedEval.utils.list_tree")
(value\_lists) | |
| [`get_emd`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/utils/index.html#FedEval.utils.get_emd "FedEval.utils.get_emd")
(non\_iid\_data) | |
| [`multiple_process`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/utils/index.html#FedEval.utils.multiple_process "FedEval.utils.multiple_process")
(distribute\_list, partition\_data\_func, ...) | rtype: |
FedEval.utils.pickle\_string\_to\_obj(_s_)[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/utils/index.html#FedEval.utils.pickle_string_to_obj "Link to this definition")
FedEval.utils.obj\_to\_pickle\_string(_x_, _file\_path\=None_)[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/utils/index.html#FedEval.utils.obj_to_pickle_string "Link to this definition")
FedEval.utils.list\_tree(_value\_lists_)[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/utils/index.html#FedEval.utils.list_tree "Link to this definition")
FedEval.utils.get\_emd(_non\_iid\_data_)[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/utils/index.html#FedEval.utils.get_emd "Link to this definition")
_class_ FedEval.utils.ParamParser[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/utils/index.html#FedEval.utils.ParamParser "Link to this definition")
Bases: [`ParamParserInterface`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/utils/index.html#FedEval.utils.ParamParserInterface "FedEval.utils.ParamParserInterface")
an implentation of ParamParserInterface.
_static_ parse\_model()[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/utils/index.html#FedEval.utils.ParamParser.parse_model "Link to this definition")
construct a tensorflow model according to the model configuration.
Raises:
**NotImplementedError** – raised when called but not overriden.
Returns:
the model constructed.
Return type:
tf.keras.Model
_static_ parse\_data(_client\_id_) → Tuple\[XYData, XYData, XYData\][](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/utils/index.html#FedEval.utils.ParamParser.parse_data "Link to this definition")
load data for train/test/validation purpose according to the data configuration.
client\_id[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/utils/index.html#FedEval.utils.ParamParser.client_id "Link to this definition")
the id of the client which issued this data parse procedure.
Raises:
**NotImplementedError** – raised when called but not overriden.
Returns:
\[data for train, data for test, data for validation\]
Return type:
Tuple\[XYData, XYData, XYData\]
_class_ FedEval.utils.ParamParserInterface[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/utils/index.html#FedEval.utils.ParamParserInterface "Link to this definition")
Abstract class of ParamParser, containing basic params parse functions.
Raises:
**NotImplementedError** – raised when methods in this class was not implemented.
_abstract static_ parse\_model() → tensorflow.keras.Model[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/utils/index.html#FedEval.utils.ParamParserInterface.parse_model "Link to this definition")
construct a tensorflow model according to the model configuration.
Raises:
**NotImplementedError** – raised when called but not overriden.
Returns:
the model constructed.
Return type:
tf.keras.Model
_abstract static_ parse\_data(_client\_id_) → Tuple\[XYData, XYData, XYData\][](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/utils/index.html#FedEval.utils.ParamParserInterface.parse_data "Link to this definition")
load data for train/test/validation purpose according to the data configuration.
client\_id[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/utils/index.html#FedEval.utils.ParamParserInterface.client_id "Link to this definition")
the id of the client which issued this data parse procedure.
Raises:
**NotImplementedError** – raised when called but not overriden.
Returns:
\[data for train, data for test, data for validation\]
Return type:
Tuple\[XYData, XYData, XYData\]
_class_ FedEval.utils.LogAnalysis(_log\_dir_)[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/utils/index.html#FedEval.utils.LogAnalysis "Link to this definition")
plot(_join\_keys\=('data\_config$$dataset',)_, _label\_keys\=('model\_config$$FedModel$$name',)_)[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/utils/index.html#FedEval.utils.LogAnalysis.plot "Link to this definition")
parse\_dict\_keys(_config_, _front\=''_)[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/utils/index.html#FedEval.utils.LogAnalysis.parse_dict_keys "Link to this definition")
recursive\_retrieve(_dict\_data_, _string\_keys_)[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/utils/index.html#FedEval.utils.LogAnalysis.recursive_retrieve "Link to this definition")
retrieve\_diff\_configs()[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/utils/index.html#FedEval.utils.LogAnalysis.retrieve_diff_configs "Link to this definition")
parse\_results()[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/utils/index.html#FedEval.utils.LogAnalysis.parse_results "Link to this definition")
aggregate\_csv\_results()[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/utils/index.html#FedEval.utils.LogAnalysis.aggregate_csv_results "Link to this definition")
to\_csv(_file\_name\='average\_results.csv'_)[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/utils/index.html#FedEval.utils.LogAnalysis.to_csv "Link to this definition")
process\_central\_simulate\_results(_log\_files_)[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/utils/index.html#FedEval.utils.LogAnalysis.process_central_simulate_results "Link to this definition")
process\_fedsgd\_simulate\_results(_log\_files_)[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/utils/index.html#FedEval.utils.LogAnalysis.process_fedsgd_simulate_results "Link to this definition")
process\_local\_simulate\_results(_log\_files_)[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/utils/index.html#FedEval.utils.LogAnalysis.process_local_simulate_results "Link to this definition")
_class_ FedEval.utils.History(_path_)[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/utils/index.html#FedEval.utils.History "Link to this definition")
\_real\_config\_id(_config\_id_)[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/utils/index.html#FedEval.utils.History._real_config_id "Link to this definition")
check\_exist(_config\_id_) → bool[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/utils/index.html#FedEval.utils.History.check_exist "Link to this definition")
update(_config\_id_, _log\_path_)[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/utils/index.html#FedEval.utils.History.update "Link to this definition")
flush()[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/utils/index.html#FedEval.utils.History.flush "Link to this definition")
delete(_config\_id_)[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/utils/index.html#FedEval.utils.History.delete "Link to this definition")
query(_config\_id_)[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/utils/index.html#FedEval.utils.History.query "Link to this definition")
FedEval.utils.multiple\_process(_distribute\_list_, _partition\_data\_func_, _task\_function_, _n\_jobs_, _reduce\_function_, _parameter\_list_)[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/utils/index.html#FedEval.utils.multiple_process "Link to this definition")
Return type:
---
# 5.1.1.7. FedEval.secure_protocols — FedEval documentation
* [](https://fedeval.readthedocs.io/en/latest/index.html)
* [5\. API Reference](https://fedeval.readthedocs.io/en/latest/autoapi/index.html)
* [5.1. `FedEval`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/index.html)
* 5.1.1.7. `FedEval.secure_protocols`
* [Edit on GitHub](https://github.com/Di-Chai/FedEval/blob/master/docs/autoapi/FedEval/secure_protocols/index.rst)
* * *
5.1.1.7. [`FedEval.secure_protocols`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/secure_protocols/index.html#module-FedEval.secure_protocols "FedEval.secure_protocols")
[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/secure_protocols/index.html#module-FedEval.secure_protocols "Link to this heading")
========================================================================================================================================================================================================================================================================================================================================
5.1.1.7.1. Submodules[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/secure_protocols/index.html#submodules "Link to this heading")
-------------------------------------------------------------------------------------------------------------------------------------------------
* [5.1.1.7.1.1. `FedEval.secure_protocols.encryption_base`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/secure_protocols/encryption_base/index.html)
* [5.1.1.7.1.2. `FedEval.secure_protocols.finite_field`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/secure_protocols/finite_field/index.html)
* [5.1.1.7.1.3. `FedEval.secure_protocols.shamir_secret_sharing`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/secure_protocols/shamir_secret_sharing/index.html)
5.1.1.7.2. Package Contents[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/secure_protocols/index.html#package-contents "Link to this heading")
-------------------------------------------------------------------------------------------------------------------------------------------------------------
### 5.1.1.7.2.1. Classes[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/secure_protocols/index.html#classes "Link to this heading")
| | |
| --- | --- |
| [`GaloisFieldNumber`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/secure_protocols/index.html#FedEval.secure_protocols.GaloisFieldNumber "FedEval.secure_protocols.GaloisFieldNumber") | |
| [`GaloisFieldParams`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/secure_protocols/index.html#FedEval.secure_protocols.GaloisFieldParams "FedEval.secure_protocols.GaloisFieldParams") | |
| [`ShamirSecretSharing`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/secure_protocols/index.html#FedEval.secure_protocols.ShamirSecretSharing "FedEval.secure_protocols.ShamirSecretSharing") | |
### 5.1.1.7.2.2. Functions[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/secure_protocols/index.html#functions "Link to this heading")
| | |
| --- | --- |
| [`aes_gcm_encrypt`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/secure_protocols/index.html#FedEval.secure_protocols.aes_gcm_encrypt "FedEval.secure_protocols.aes_gcm_encrypt")
(private\_key, message\[, user\_add\]) | |
| [`aes_gcm_decrypt`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/secure_protocols/index.html#FedEval.secure_protocols.aes_gcm_decrypt "FedEval.secure_protocols.aes_gcm_decrypt")
(key, received\_message) | |
FedEval.secure\_protocols.aes\_gcm\_encrypt(_private\_key_, _message_, _user\_add\='Default Additional Information'_)[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/secure_protocols/index.html#FedEval.secure_protocols.aes_gcm_encrypt "Link to this definition")
FedEval.secure\_protocols.aes\_gcm\_decrypt(_key_, _received\_message_)[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/secure_protocols/index.html#FedEval.secure_protocols.aes_gcm_decrypt "Link to this definition")
_class_ FedEval.secure\_protocols.GaloisFieldNumber(_encoding: int_, _exponent: int_, _gfp: [GaloisFieldParams](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/secure_protocols/index.html#FedEval.secure_protocols.GaloisFieldParams "FedEval.secure_protocols.GaloisFieldParams")
_)[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/secure_protocols/index.html#FedEval.secure_protocols.GaloisFieldNumber "Link to this definition")
BASE _\= 16_[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/secure_protocols/index.html#FedEval.secure_protocols.GaloisFieldNumber.BASE "Link to this definition")
LOG2\_BASE[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/secure_protocols/index.html#FedEval.secure_protocols.GaloisFieldNumber.LOG2_BASE "Link to this definition")
FLOAT\_MANTISSA\_BITS[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/secure_protocols/index.html#FedEval.secure_protocols.GaloisFieldNumber.FLOAT_MANTISSA_BITS "Link to this definition")
FULL\_PRECISION[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/secure_protocols/index.html#FedEval.secure_protocols.GaloisFieldNumber.FULL_PRECISION "Link to this definition")
_classmethod_ encode(_scalar_, _gfp: [GaloisFieldParams](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/secure_protocols/index.html#FedEval.secure_protocols.GaloisFieldParams "FedEval.secure_protocols.GaloisFieldParams")
_, _exponent\=FULL\_PRECISION_)[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/secure_protocols/index.html#FedEval.secure_protocols.GaloisFieldNumber.encode "Link to this definition")
decode()[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/secure_protocols/index.html#FedEval.secure_protocols.GaloisFieldNumber.decode "Link to this definition")
Decode plaintext and return the result. :returns:
> the decoded number. N.B. if the number
>
> returned is an integer, it will not be of type float.
Return type:
an int or float
Raises:
**OverflowError** – if overflow is detected in the decrypted number.
decrease\_exponent\_to(_new\_exp_)[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/secure_protocols/index.html#FedEval.secure_protocols.GaloisFieldNumber.decrease_exponent_to "Link to this definition")
\_\_add\_\_(_other_)[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/secure_protocols/index.html#FedEval.secure_protocols.GaloisFieldNumber.__add__ "Link to this definition")
\_\_iadd\_\_(_other_)[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/secure_protocols/index.html#FedEval.secure_protocols.GaloisFieldNumber.__iadd__ "Link to this definition")
\_\_radd\_\_(_other_)[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/secure_protocols/index.html#FedEval.secure_protocols.GaloisFieldNumber.__radd__ "Link to this definition")
\_\_sub\_\_(_other_)[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/secure_protocols/index.html#FedEval.secure_protocols.GaloisFieldNumber.__sub__ "Link to this definition")
\_\_rsub\_\_(_other_)[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/secure_protocols/index.html#FedEval.secure_protocols.GaloisFieldNumber.__rsub__ "Link to this definition")
\_\_mul\_\_(_other_)[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/secure_protocols/index.html#FedEval.secure_protocols.GaloisFieldNumber.__mul__ "Link to this definition")
\_\_rmul\_\_(_other_)[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/secure_protocols/index.html#FedEval.secure_protocols.GaloisFieldNumber.__rmul__ "Link to this definition")
\_\_truediv\_\_(_other_)[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/secure_protocols/index.html#FedEval.secure_protocols.GaloisFieldNumber.__truediv__ "Link to this definition")
\_\_rtruediv\_\_(_other_)[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/secure_protocols/index.html#FedEval.secure_protocols.GaloisFieldNumber.__rtruediv__ "Link to this definition")
_class_ FedEval.secure\_protocols.GaloisFieldParams(_p_)[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/secure_protocols/index.html#FedEval.secure_protocols.GaloisFieldParams "Link to this definition")
_property_ p[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/secure_protocols/index.html#FedEval.secure_protocols.GaloisFieldParams.p "Link to this definition")
_property_ max\_int[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/secure_protocols/index.html#FedEval.secure_protocols.GaloisFieldParams.max_int "Link to this definition")
_class_ FedEval.secure\_protocols.ShamirSecretSharing(_m_, _n_, _p\=2\*\*521 \- 1_)[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/secure_protocols/index.html#FedEval.secure_protocols.ShamirSecretSharing "Link to this definition")
\_eval\_at(_poly_, _x_)[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/secure_protocols/index.html#FedEval.secure_protocols.ShamirSecretSharing._eval_at "Link to this definition")
Evaluates polynomial (coefficient tuple) at x, used to generate a shamir pool in make\_random\_shares below.
share(_secret_)[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/secure_protocols/index.html#FedEval.secure_protocols.ShamirSecretSharing.share "Link to this definition")
Generates a random shamir pool for a given secret, returns share points.
recon(_shares_)[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/secure_protocols/index.html#FedEval.secure_protocols.ShamirSecretSharing.recon "Link to this definition")
Recover the secret from share points (x, y points on the polynomial).
---
# 5.1.1.4. FedEval.dataset — FedEval documentation
* [](https://fedeval.readthedocs.io/en/latest/index.html)
* [5\. API Reference](https://fedeval.readthedocs.io/en/latest/autoapi/index.html)
* [5.1. `FedEval`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/index.html)
* 5.1.1.4. `FedEval.dataset`
* [Edit on GitHub](https://github.com/Di-Chai/FedEval/blob/master/docs/autoapi/FedEval/dataset/index.rst)
* * *
5.1.1.4. [`FedEval.dataset`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/dataset/index.html#module-FedEval.dataset "FedEval.dataset")
[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/dataset/index.html#module-FedEval.dataset "Link to this heading")
==================================================================================================================================================================================================================================================================================
5.1.1.4.1. Submodules[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/dataset/index.html#submodules "Link to this heading")
----------------------------------------------------------------------------------------------------------------------------------------
* [5.1.1.4.1.1. `FedEval.dataset.CelebA`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/dataset/CelebA/index.html)
* [5.1.1.4.1.2. `FedEval.dataset.FEMNIST`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/dataset/FEMNIST/index.html)
* [5.1.1.4.1.3. `FedEval.dataset.FedDataBase`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/dataset/FedDataBase/index.html)
* [5.1.1.4.1.4. `FedEval.dataset.FedImage`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/dataset/FedImage/index.html)
* [5.1.1.4.1.5. `FedEval.dataset.FedMatrix`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/dataset/FedMatrix/index.html)
* [5.1.1.4.1.6. `FedEval.dataset.Sentiment140`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/dataset/Sentiment140/index.html)
* [5.1.1.4.1.7. `FedEval.dataset.Shakespeare`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/dataset/Shakespeare/index.html)
5.1.1.4.2. Package Contents[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/dataset/index.html#package-contents "Link to this heading")
----------------------------------------------------------------------------------------------------------------------------------------------------
### 5.1.1.4.2.1. Classes[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/dataset/index.html#classes "Link to this heading")
| | |
| --- | --- |
| [`FedData`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/dataset/index.html#id31 "FedEval.dataset.FedData") | By default, FedData produces datasets for horizontal federated learning |
| [`mnist`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/dataset/index.html#FedEval.dataset.mnist "FedEval.dataset.mnist") | By default, FedData produces datasets for horizontal federated learning |
| [`cifar10`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/dataset/index.html#FedEval.dataset.cifar10 "FedEval.dataset.cifar10") | By default, FedData produces datasets for horizontal federated learning |
| [`cifar100`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/dataset/index.html#FedEval.dataset.cifar100 "FedEval.dataset.cifar100") | By default, FedData produces datasets for horizontal federated learning |
| [`FedData`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/dataset/index.html#id31 "FedEval.dataset.FedData") | By default, FedData produces datasets for horizontal federated learning |
| [`ConfigurationManager`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/dataset/index.html#FedEval.dataset.ConfigurationManager "FedEval.dataset.ConfigurationManager") | the base class of singletons. |
| [`FedVerticalMatrix`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/dataset/index.html#FedEval.dataset.FedVerticalMatrix "FedEval.dataset.FedVerticalMatrix") | By default, FedData produces datasets for horizontal federated learning |
| [`wine`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/dataset/index.html#FedEval.dataset.wine "FedEval.dataset.wine") | By default, FedData produces datasets for horizontal federated learning |
| [`mnist_matrix`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/dataset/index.html#FedEval.dataset.mnist_matrix "FedEval.dataset.mnist_matrix") | By default, FedData produces datasets for horizontal federated learning |
| [`synthetic_matrix_horizontal`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/dataset/index.html#FedEval.dataset.synthetic_matrix_horizontal "FedEval.dataset.synthetic_matrix_horizontal") | By default, FedData produces datasets for horizontal federated learning |
| [`synthetic_matrix_vertical`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/dataset/index.html#FedEval.dataset.synthetic_matrix_vertical "FedEval.dataset.synthetic_matrix_vertical") | By default, FedData produces datasets for horizontal federated learning |
| [`synthetic_matrix_horizontal_memmap`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/dataset/index.html#FedEval.dataset.synthetic_matrix_horizontal_memmap "FedEval.dataset.synthetic_matrix_horizontal_memmap") | By default, FedData produces datasets for horizontal federated learning |
| [`ml25m_matrix`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/dataset/index.html#FedEval.dataset.ml25m_matrix "FedEval.dataset.ml25m_matrix") | By default, FedData produces datasets for horizontal federated learning |
| [`vertical_linear_regression`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/dataset/index.html#FedEval.dataset.vertical_linear_regression "FedEval.dataset.vertical_linear_regression") | By default, FedData produces datasets for horizontal federated learning |
| [`vertical_linear_regression_memmap`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/dataset/index.html#FedEval.dataset.vertical_linear_regression_memmap "FedEval.dataset.vertical_linear_regression_memmap") | By default, FedData produces datasets for horizontal federated learning |
| [`ml25m_matrix_memmap`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/dataset/index.html#FedEval.dataset.ml25m_matrix_memmap "FedEval.dataset.ml25m_matrix_memmap") | By default, FedData produces datasets for horizontal federated learning |
| [`ml100k_lr`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/dataset/index.html#FedEval.dataset.ml100k_lr "FedEval.dataset.ml100k_lr") | By default, FedData produces datasets for horizontal federated learning |
| [`FedData`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/dataset/index.html#id31 "FedEval.dataset.FedData") | By default, FedData produces datasets for horizontal federated learning |
| [`sentiment140`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/dataset/index.html#FedEval.dataset.sentiment140 "FedEval.dataset.sentiment140") | By default, FedData produces datasets for horizontal federated learning |
| [`FedData`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/dataset/index.html#id31 "FedEval.dataset.FedData") | By default, FedData produces datasets for horizontal federated learning |
| [`shakespeare`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/dataset/index.html#FedEval.dataset.shakespeare "FedEval.dataset.shakespeare") | By default, FedData produces datasets for horizontal federated learning |
| [`FedData`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/dataset/index.html#id31 "FedEval.dataset.FedData") | By default, FedData produces datasets for horizontal federated learning |
| [`celeba`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/dataset/index.html#FedEval.dataset.celeba "FedEval.dataset.celeba") | CelebA Median: Top 1000 clients |
| [`FedData`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/dataset/index.html#id31 "FedEval.dataset.FedData") | By default, FedData produces datasets for horizontal federated learning |
| [`femnist`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/dataset/index.html#FedEval.dataset.femnist "FedEval.dataset.femnist") | FEMnistLarge, 3500 Clients |
### 5.1.1.4.2.2. Functions[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/dataset/index.html#functions "Link to this heading")
| | |
| --- | --- |
| [`shuffle`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/dataset/index.html#id38 "FedEval.dataset.shuffle")
(X, Y) | Input (X, Y) pairs, shuffle and return it. |
| [`shuffle`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/dataset/index.html#id38 "FedEval.dataset.shuffle")
(X, Y) | Input (X, Y) pairs, shuffle and return it. |
| [`load_synthetic`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/dataset/index.html#FedEval.dataset.load_synthetic "FedEval.dataset.load_synthetic")
(m, n, alpha) | |
| [`load_synthetic_large_scale`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/dataset/index.html#FedEval.dataset.load_synthetic_large_scale "FedEval.dataset.load_synthetic_large_scale")
(m, n, alpha) | |
| [`normalize_text`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/dataset/index.html#FedEval.dataset.normalize_text "FedEval.dataset.normalize_text")
(text) | Final cleanup of text by removing non-alpha characters like ' |
| [`hashtags_preprocess`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/dataset/index.html#FedEval.dataset.hashtags_preprocess "FedEval.dataset.hashtags_preprocess")
(x) | Creating a hashtag token and processing the formatting of hastags, i.e. separate uppercase words |
| [`allcaps_preprocess`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/dataset/index.html#FedEval.dataset.allcaps_preprocess "FedEval.dataset.allcaps_preprocess")
(x) | If text/word written in uppercase, change to lowercase and tag with . |
| [`glove_preprocess`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/dataset/index.html#FedEval.dataset.glove_preprocess "FedEval.dataset.glove_preprocess")
(text) | To be consistent with use of GloVe vectors, we replicate most of their preprocessing. |
| [`tweet2Vec`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/dataset/index.html#FedEval.dataset.tweet2Vec "FedEval.dataset.tweet2Vec")
(tweet, word2vectors) | Takes in a processed tweet, tokenizes it, converts to GloVe embeddings |
| [`shuffle`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/dataset/index.html#id38 "FedEval.dataset.shuffle")
(X, Y) | Input (X, Y) pairs, shuffle and return it. |
| [`shuffle`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/dataset/index.html#id38 "FedEval.dataset.shuffle")
(X, Y) | Input (X, Y) pairs, shuffle and return it. |
| [`shuffle`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/dataset/index.html#id38 "FedEval.dataset.shuffle")
(X, Y) | Input (X, Y) pairs, shuffle and return it. |
| [`get_data_shape`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/dataset/index.html#FedEval.dataset.get_data_shape "FedEval.dataset.get_data_shape")
(dataset\_name) | |
_class_ FedEval.dataset.FedData[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/dataset/index.html#FedEval.dataset.FedData "Link to this definition")
By default, FedData produces datasets for horizontal federated learning
_property_ need\_regenerate_: bool_[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/dataset/index.html#FedEval.dataset.FedData.need_regenerate "Link to this definition")
\_load\_and\_process\_data()[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/dataset/index.html#FedEval.dataset.FedData._load_and_process_data "Link to this definition")
_abstract_ load\_data()[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/dataset/index.html#FedEval.dataset.FedData.load_data "Link to this definition")
iid\_data(_save\_file\=True_)[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/dataset/index.html#FedEval.dataset.FedData.iid_data "Link to this definition")
\_save\_dataset\_files(_dataset: List\[Mapping\[str, List\[numpy.ndarray\]\]\]_) → None[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/dataset/index.html#FedEval.dataset.FedData._save_dataset_files "Link to this definition")
non\_iid\_data(_save\_file\=True_, _called\_in\_iid\=False_) → List\[Mapping\[str, List\[numpy.ndarray\]\]\][](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/dataset/index.html#FedEval.dataset.FedData.non_iid_data "Link to this definition")
FedEval.dataset.shuffle(_X_, _Y_)[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/dataset/index.html#FedEval.dataset.shuffle "Link to this definition")
Input (X, Y) pairs, shuffle and return it.
_class_ FedEval.dataset.mnist[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/dataset/index.html#FedEval.dataset.mnist "Link to this definition")
Bases: [`FedEval.dataset.FedDataBase.FedData`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/dataset/FedDataBase/index.html#FedEval.dataset.FedDataBase.FedData "FedEval.dataset.FedDataBase.FedData")
By default, FedData produces datasets for horizontal federated learning
load\_data()[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/dataset/index.html#FedEval.dataset.mnist.load_data "Link to this definition")
_class_ FedEval.dataset.cifar10[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/dataset/index.html#FedEval.dataset.cifar10 "Link to this definition")
Bases: [`FedEval.dataset.FedDataBase.FedData`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/dataset/FedDataBase/index.html#FedEval.dataset.FedDataBase.FedData "FedEval.dataset.FedDataBase.FedData")
By default, FedData produces datasets for horizontal federated learning
load\_data()[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/dataset/index.html#FedEval.dataset.cifar10.load_data "Link to this definition")
_class_ FedEval.dataset.cifar100[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/dataset/index.html#FedEval.dataset.cifar100 "Link to this definition")
Bases: [`FedEval.dataset.FedDataBase.FedData`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/dataset/FedDataBase/index.html#FedEval.dataset.FedDataBase.FedData "FedEval.dataset.FedDataBase.FedData")
By default, FedData produces datasets for horizontal federated learning
load\_data()[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/dataset/index.html#FedEval.dataset.cifar100.load_data "Link to this definition")
_class_ FedEval.dataset.FedData[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/dataset/index.html#id0 "Link to this definition")
By default, FedData produces datasets for horizontal federated learning
_property_ need\_regenerate_: bool_[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/dataset/index.html#id1 "Link to this definition")
\_load\_and\_process\_data()[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/dataset/index.html#id2 "Link to this definition")
_abstract_ load\_data()[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/dataset/index.html#id3 "Link to this definition")
iid\_data(_save\_file\=True_)[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/dataset/index.html#id4 "Link to this definition")
\_save\_dataset\_files(_dataset: List\[Mapping\[str, List\[numpy.ndarray\]\]\]_) → None[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/dataset/index.html#id5 "Link to this definition")
non\_iid\_data(_save\_file\=True_, _called\_in\_iid\=False_) → List\[Mapping\[str, List\[numpy.ndarray\]\]\][](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/dataset/index.html#id6 "Link to this definition")
FedEval.dataset.shuffle(_X_, _Y_)[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/dataset/index.html#id7 "Link to this definition")
Input (X, Y) pairs, shuffle and return it.
_class_ FedEval.dataset.ConfigurationManager(_data\_config: RawConfigurationDict \= \_DEFAULT\_D\_CFG_, _model\_config: RawConfigurationDict \= \_DEFAULT\_MDL\_CFG_, _runtime\_config: RawConfigurationDict \= \_DEFAULT\_RT\_CFG_, _thread\_safe: bool \= False_)[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/dataset/index.html#FedEval.dataset.ConfigurationManager "Link to this definition")
Bases: [`FedEval.config.singleton.Singleton`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/config/singleton/index.html#FedEval.config.singleton.Singleton "FedEval.config.singleton.Singleton")
, `ConfigurationManagerInterface`, `ClientConfigurationManagerInterface`, `ServerConfigurationManagerInterface`, `_CfgYamlInterface`, `_CfgJsonInterface`, `_CfgFileInterface`, `_RoledConfigurationInterface`
the base class of singletons. Each cls on the inheritance tree can own only one instance.
_property_ data\_unique\_id[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/dataset/index.html#FedEval.dataset.ConfigurationManager.data_unique_id "Link to this definition")
_property_ config\_unique\_id[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/dataset/index.html#FedEval.dataset.ConfigurationManager.config_unique_id "Link to this definition")
_property_ data\_dir\_name_: str_[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/dataset/index.html#FedEval.dataset.ConfigurationManager.data_dir_name "Link to this definition")
The output directory of the clients’ data.
Returns:
the name of the data directory.
Return type:
str
_property_ log\_dir\_path_: str_[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/dataset/index.html#FedEval.dataset.ConfigurationManager.log_dir_path "Link to this definition")
the path of the base of log directory.
_property_ history\_record\_path_: str_[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/dataset/index.html#FedEval.dataset.ConfigurationManager.history_record_path "Link to this definition")
the path of the history record.
_property_ job\_id_: str_[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/dataset/index.html#FedEval.dataset.ConfigurationManager.job_id "Link to this definition")
_property_ encoding_: str_[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/dataset/index.html#FedEval.dataset.ConfigurationManager.encoding "Link to this definition")
the encoding scheme during (de)serialization.
_property_ data\_config\_filename_: str_[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/dataset/index.html#FedEval.dataset.ConfigurationManager.data_config_filename "Link to this definition")
_property_ model\_config\_filename_: str_[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/dataset/index.html#FedEval.dataset.ConfigurationManager.model_config_filename "Link to this definition")
_property_ runtime\_config\_filename_: str_[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/dataset/index.html#FedEval.dataset.ConfigurationManager.runtime_config_filename "Link to this definition")
_property_ data\_config_: [\_DataConfig](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/config/configuration/index.html#FedEval.config.configuration._DataConfig "FedEval.config.configuration._DataConfig")
_[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/dataset/index.html#FedEval.dataset.ConfigurationManager.data_config "Link to this definition")
_property_ model\_config_: [\_ModelConfig](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/config/configuration/index.html#FedEval.config.configuration._ModelConfig "FedEval.config.configuration._ModelConfig")
_[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/dataset/index.html#FedEval.dataset.ConfigurationManager.model_config "Link to this definition")
_property_ runtime\_config_: [\_RuntimeConfig](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/config/configuration/index.html#FedEval.config.configuration._RuntimeConfig "FedEval.config.configuration._RuntimeConfig")
_[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/dataset/index.html#FedEval.dataset.ConfigurationManager.runtime_config "Link to this definition")
_property_ num\_of\_train\_clients\_contacted\_per\_round_: int_[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/dataset/index.html#FedEval.dataset.ConfigurationManager.num_of_train_clients_contacted_per_round "Link to this definition")
the number of clients selected to participate the main federated process in each round.
_property_ num\_of\_eval\_clients\_contacted\_per\_round_: int_[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/dataset/index.html#FedEval.dataset.ConfigurationManager.num_of_eval_clients_contacted_per_round "Link to this definition")
the number of clients selected to participate the main federated process in each round.
_property_ role_: [FedEval.config.role.Role](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/config/role/index.html#FedEval.config.role.Role "FedEval.config.role.Role")
_[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/dataset/index.html#FedEval.dataset.ConfigurationManager.role "Link to this definition")
return the role of this runtime entity.
Raises:
**AttributeError** – called without role configured.
Returns:
the role of this runtime entity.
Return type:
[Role](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/config/index.html#FedEval.config.Role "FedEval.config.Role")
\_\_init\_once\_lock[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/dataset/index.html#FedEval.dataset.ConfigurationManager.__init_once_lock "Link to this definition")
\_\_initiated _\= False_[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/dataset/index.html#FedEval.dataset.ConfigurationManager.__initiated "Link to this definition")
\_init\_file\_names(_data\_config\_filename: str \= DEFAULT\_D\_CFG\_FILENAME\_YAML_, _model\_config\_filename: str \= DEFAULT\_MDL\_CFG\_FILENAME\_YAML_, _runtime\_config\_filename: str \= DEFAULT\_RT\_CFG\_FILENAME\_YAML_) → None[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/dataset/index.html#FedEval.dataset.ConfigurationManager._init_file_names "Link to this definition")
_classmethod_ generate\_unique\_id(_data\_config: dict_, _model\_config: dict_, _runtime\_config: dict_)[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/dataset/index.html#FedEval.dataset.ConfigurationManager.generate_unique_id "Link to this definition")
_static_ \_get\_md5(_config\_string_)[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/dataset/index.html#FedEval.dataset.ConfigurationManager._get_md5 "Link to this definition")
_static_ load\_configs(_src\_path_, _serializer: str | [\_CfgSerializer](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/config/configuration/index.html#FedEval.config.configuration._CfgSerializer "FedEval.config.configuration._CfgSerializer")
\= \_CfgSerializer.YAML_, _data\_config\_filename: str \= DEFAULT\_D\_CFG\_FILENAME\_YAML_, _model\_config\_filename: str \= DEFAULT\_MDL\_CFG\_FILENAME\_YAML_, _runtime\_config\_filename: str \= DEFAULT\_RT\_CFG\_FILENAME\_YAML_, _encoding\=\_DEFAULT\_ENCODING_) → Tuple\[RawConfigurationDict, RawConfigurationDict, RawConfigurationDict\][](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/dataset/index.html#FedEval.dataset.ConfigurationManager.load_configs "Link to this definition")
_static_ save\_configs(_data\_cfg: RawConfigurationDict_, _model\_cfg: RawConfigurationDict_, _runtime\_cfg: RawConfigurationDict_, _dst\_path_, _data\_config\_filename: str \= DEFAULT\_D\_CFG\_FILENAME\_YAML_, _model\_config\_filename: str \= DEFAULT\_MDL\_CFG\_FILENAME\_YAML_, _runtime\_config\_filename: str \= DEFAULT\_RT\_CFG\_FILENAME\_YAML_, _encoding\=\_DEFAULT\_ENCODING_, _serializer: str | [\_CfgSerializer](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/config/configuration/index.html#FedEval.config.configuration._CfgSerializer "FedEval.config.configuration._CfgSerializer")
\= \_CfgSerializer.YAML_)[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/dataset/index.html#FedEval.dataset.ConfigurationManager.save_configs "Link to this definition")
_static_ from\_files(_src\_path: str_, _data\_config\_filename: str \= DEFAULT\_D\_CFG\_FILENAME\_YAML_, _model\_config\_filename: str \= DEFAULT\_MDL\_CFG\_FILENAME\_YAML_, _runtime\_config\_filename: str \= DEFAULT\_RT\_CFG\_FILENAME\_YAML_, _serializer: str | [\_CfgSerializer](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/config/configuration/index.html#FedEval.config.configuration._CfgSerializer "FedEval.config.configuration._CfgSerializer")
\= \_CfgSerializer.YAML_, _encoding\=\_DEFAULT\_ENCODING_)[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/dataset/index.html#FedEval.dataset.ConfigurationManager.from_files "Link to this definition")
to\_files(_dst\_dir\_path: str_, _serializer: str | [\_CfgSerializer](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/config/configuration/index.html#FedEval.config.configuration._CfgSerializer "FedEval.config.configuration._CfgSerializer")
\= \_CfgSerializer.YAML_, _encoding: str | None \= None_) → None[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/dataset/index.html#FedEval.dataset.ConfigurationManager.to_files "Link to this definition")
\_\_init\_role() → None[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/dataset/index.html#FedEval.dataset.ConfigurationManager.__init_role "Link to this definition")
_class_ FedEval.dataset.FedVerticalMatrix[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/dataset/index.html#FedEval.dataset.FedVerticalMatrix "Link to this definition")
Bases: [`FedEval.dataset.FedDataBase.FedData`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/dataset/FedDataBase/index.html#FedEval.dataset.FedDataBase.FedData "FedEval.dataset.FedDataBase.FedData")
, `abc.ABC`
By default, FedData produces datasets for horizontal federated learning
non\_iid\_data(_\*args_)[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/dataset/index.html#FedEval.dataset.FedVerticalMatrix.non_iid_data "Link to this definition")
iid\_data(_save\_file\=True_)[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/dataset/index.html#FedEval.dataset.FedVerticalMatrix.iid_data "Link to this definition")
_class_ FedEval.dataset.wine[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/dataset/index.html#FedEval.dataset.wine "Link to this definition")
Bases: [`FedVerticalMatrix`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/dataset/index.html#FedEval.dataset.FedVerticalMatrix "FedEval.dataset.FedVerticalMatrix")
By default, FedData produces datasets for horizontal federated learning
load\_data()[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/dataset/index.html#FedEval.dataset.wine.load_data "Link to this definition")
_class_ FedEval.dataset.mnist\_matrix[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/dataset/index.html#FedEval.dataset.mnist_matrix "Link to this definition")
Bases: [`FedVerticalMatrix`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/dataset/index.html#FedEval.dataset.FedVerticalMatrix "FedEval.dataset.FedVerticalMatrix")
By default, FedData produces datasets for horizontal federated learning
load\_data()[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/dataset/index.html#FedEval.dataset.mnist_matrix.load_data "Link to this definition")
FedEval.dataset.load\_synthetic(_m_, _n_, _alpha_)[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/dataset/index.html#FedEval.dataset.load_synthetic "Link to this definition")
FedEval.dataset.load\_synthetic\_large\_scale(_m_, _n_, _alpha_)[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/dataset/index.html#FedEval.dataset.load_synthetic_large_scale "Link to this definition")
_class_ FedEval.dataset.synthetic\_matrix\_horizontal[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/dataset/index.html#FedEval.dataset.synthetic_matrix_horizontal "Link to this definition")
Bases: [`FedEval.dataset.FedDataBase.FedData`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/dataset/FedDataBase/index.html#FedEval.dataset.FedDataBase.FedData "FedEval.dataset.FedDataBase.FedData")
By default, FedData produces datasets for horizontal federated learning
load\_data()[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/dataset/index.html#FedEval.dataset.synthetic_matrix_horizontal.load_data "Link to this definition")
_class_ FedEval.dataset.synthetic\_matrix\_vertical[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/dataset/index.html#FedEval.dataset.synthetic_matrix_vertical "Link to this definition")
Bases: [`FedEval.dataset.FedDataBase.FedData`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/dataset/FedDataBase/index.html#FedEval.dataset.FedDataBase.FedData "FedEval.dataset.FedDataBase.FedData")
By default, FedData produces datasets for horizontal federated learning
load\_data()[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/dataset/index.html#FedEval.dataset.synthetic_matrix_vertical.load_data "Link to this definition")
_class_ FedEval.dataset.synthetic\_matrix\_horizontal\_memmap[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/dataset/index.html#FedEval.dataset.synthetic_matrix_horizontal_memmap "Link to this definition")
Bases: [`FedEval.dataset.FedDataBase.FedData`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/dataset/FedDataBase/index.html#FedEval.dataset.FedDataBase.FedData "FedEval.dataset.FedDataBase.FedData")
By default, FedData produces datasets for horizontal federated learning
load\_data()[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/dataset/index.html#FedEval.dataset.synthetic_matrix_horizontal_memmap.load_data "Link to this definition")
iid\_data(_save\_file\=True_)[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/dataset/index.html#FedEval.dataset.synthetic_matrix_horizontal_memmap.iid_data "Link to this definition")
_class_ FedEval.dataset.ml25m\_matrix[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/dataset/index.html#FedEval.dataset.ml25m_matrix "Link to this definition")
Bases: [`FedEval.dataset.FedDataBase.FedData`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/dataset/FedDataBase/index.html#FedEval.dataset.FedDataBase.FedData "FedEval.dataset.FedDataBase.FedData")
By default, FedData produces datasets for horizontal federated learning
load\_data()[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/dataset/index.html#FedEval.dataset.ml25m_matrix.load_data "Link to this definition")
_class_ FedEval.dataset.vertical\_linear\_regression[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/dataset/index.html#FedEval.dataset.vertical_linear_regression "Link to this definition")
Bases: [`FedVerticalMatrix`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/dataset/index.html#FedEval.dataset.FedVerticalMatrix "FedEval.dataset.FedVerticalMatrix")
By default, FedData produces datasets for horizontal federated learning
load\_data()[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/dataset/index.html#FedEval.dataset.vertical_linear_regression.load_data "Link to this definition")
_class_ FedEval.dataset.vertical\_linear\_regression\_memmap[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/dataset/index.html#FedEval.dataset.vertical_linear_regression_memmap "Link to this definition")
Bases: [`FedVerticalMatrix`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/dataset/index.html#FedEval.dataset.FedVerticalMatrix "FedEval.dataset.FedVerticalMatrix")
By default, FedData produces datasets for horizontal federated learning
load\_data()[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/dataset/index.html#FedEval.dataset.vertical_linear_regression_memmap.load_data "Link to this definition")
iid\_data(_save\_file\=True_)[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/dataset/index.html#FedEval.dataset.vertical_linear_regression_memmap.iid_data "Link to this definition")
_class_ FedEval.dataset.ml25m\_matrix\_memmap[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/dataset/index.html#FedEval.dataset.ml25m_matrix_memmap "Link to this definition")
Bases: [`vertical_linear_regression_memmap`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/dataset/index.html#FedEval.dataset.vertical_linear_regression_memmap "FedEval.dataset.vertical_linear_regression_memmap")
By default, FedData produces datasets for horizontal federated learning
load\_data()[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/dataset/index.html#FedEval.dataset.ml25m_matrix_memmap.load_data "Link to this definition")
_class_ FedEval.dataset.ml100k\_lr[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/dataset/index.html#FedEval.dataset.ml100k_lr "Link to this definition")
Bases: [`FedVerticalMatrix`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/dataset/index.html#FedEval.dataset.FedVerticalMatrix "FedEval.dataset.FedVerticalMatrix")
By default, FedData produces datasets for horizontal federated learning
load\_data()[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/dataset/index.html#FedEval.dataset.ml100k_lr.load_data "Link to this definition")
_class_ FedEval.dataset.FedData[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/dataset/index.html#id8 "Link to this definition")
By default, FedData produces datasets for horizontal federated learning
_property_ need\_regenerate_: bool_[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/dataset/index.html#id9 "Link to this definition")
\_load\_and\_process\_data()[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/dataset/index.html#id10 "Link to this definition")
_abstract_ load\_data()[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/dataset/index.html#id11 "Link to this definition")
iid\_data(_save\_file\=True_)[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/dataset/index.html#id12 "Link to this definition")
\_save\_dataset\_files(_dataset: List\[Mapping\[str, List\[numpy.ndarray\]\]\]_) → None[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/dataset/index.html#id13 "Link to this definition")
non\_iid\_data(_save\_file\=True_, _called\_in\_iid\=False_) → List\[Mapping\[str, List\[numpy.ndarray\]\]\][](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/dataset/index.html#id14 "Link to this definition")
FedEval.dataset.normalize\_text(_text_)[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/dataset/index.html#FedEval.dataset.normalize_text "Link to this definition")
> Final cleanup of text by removing non-alpha characters like ‘
‘, ‘ ‘… and
non-latin characters + stripping.
inputs:
* text (str): tweet to be processed
return:
* text (str): preprocessed tweet
FedEval.dataset.hashtags\_preprocess(_x_)[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/dataset/index.html#FedEval.dataset.hashtags_preprocess "Link to this definition")
Creating a hashtag token and processing the formatting of hastags, i.e. separate uppercase words if possible, all letters to lowercase.
inputs:
* x (regex group): x.group(1) contains the text associated with a hashtag
Returns:
preprocessed text
Return type:
* text (str)
FedEval.dataset.allcaps\_preprocess(_x_)[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/dataset/index.html#FedEval.dataset.allcaps_preprocess "Link to this definition")
If text/word written in uppercase, change to lowercase and tag with .
inputs:
* x (regex group): x.group() contains the text
Returns:
preprocessed text
Return type:
* text (str)
FedEval.dataset.glove\_preprocess(_text_)[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/dataset/index.html#FedEval.dataset.glove_preprocess "Link to this definition")
To be consistent with use of GloVe vectors, we replicate most of their preprocessing. Therefore the word distribution should be close to the one used to train the embeddings. Adapted from [https://nlp.stanford.edu/projects/glove/preprocess-twitter.rb](https://nlp.stanford.edu/projects/glove/preprocess-twitter.rb)
inputs:
* text (str): tweet to be processed
Returns:
preprocessed tweet
Return type:
* text (str)
FedEval.dataset.tweet2Vec(_tweet_, _word2vectors_)[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/dataset/index.html#FedEval.dataset.tweet2Vec "Link to this definition")
Takes in a processed tweet, tokenizes it, converts to GloVe embeddings (or zeroes if words are unknown) and applies average pool to obtain one vector for that tweet.
inputs:
* tweet (str): one raw tweet from the dataset
* word2vectors (dict): GloVe words mapped to GloVe vectors
Returns:
resulting sentence vector (shape: (200,))
Return type:
* embeddings (np.array)
_class_ FedEval.dataset.sentiment140[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/dataset/index.html#FedEval.dataset.sentiment140 "Link to this definition")
Bases: [`FedEval.dataset.FedDataBase.FedData`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/dataset/FedDataBase/index.html#FedEval.dataset.FedDataBase.FedData "FedEval.dataset.FedDataBase.FedData")
By default, FedData produces datasets for horizontal federated learning
load\_data()[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/dataset/index.html#FedEval.dataset.sentiment140.load_data "Link to this definition")
_class_ FedEval.dataset.FedData[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/dataset/index.html#id15 "Link to this definition")
By default, FedData produces datasets for horizontal federated learning
_property_ need\_regenerate_: bool_[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/dataset/index.html#id16 "Link to this definition")
\_load\_and\_process\_data()[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/dataset/index.html#id17 "Link to this definition")
_abstract_ load\_data()[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/dataset/index.html#id18 "Link to this definition")
iid\_data(_save\_file\=True_)[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/dataset/index.html#id19 "Link to this definition")
\_save\_dataset\_files(_dataset: List\[Mapping\[str, List\[numpy.ndarray\]\]\]_) → None[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/dataset/index.html#id20 "Link to this definition")
non\_iid\_data(_save\_file\=True_, _called\_in\_iid\=False_) → List\[Mapping\[str, List\[numpy.ndarray\]\]\][](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/dataset/index.html#id21 "Link to this definition")
FedEval.dataset.shuffle(_X_, _Y_)[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/dataset/index.html#id22 "Link to this definition")
Input (X, Y) pairs, shuffle and return it.
_class_ FedEval.dataset.shakespeare[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/dataset/index.html#FedEval.dataset.shakespeare "Link to this definition")
Bases: [`FedEval.dataset.FedDataBase.FedData`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/dataset/FedDataBase/index.html#FedEval.dataset.FedDataBase.FedData "FedEval.dataset.FedDataBase.FedData")
By default, FedData produces datasets for horizontal federated learning
load\_data()[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/dataset/index.html#FedEval.dataset.shakespeare.load_data "Link to this definition")
_class_ FedEval.dataset.FedData[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/dataset/index.html#id23 "Link to this definition")
By default, FedData produces datasets for horizontal federated learning
_property_ need\_regenerate_: bool_[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/dataset/index.html#id24 "Link to this definition")
\_load\_and\_process\_data()[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/dataset/index.html#id25 "Link to this definition")
_abstract_ load\_data()[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/dataset/index.html#id26 "Link to this definition")
iid\_data(_save\_file\=True_)[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/dataset/index.html#id27 "Link to this definition")
\_save\_dataset\_files(_dataset: List\[Mapping\[str, List\[numpy.ndarray\]\]\]_) → None[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/dataset/index.html#id28 "Link to this definition")
non\_iid\_data(_save\_file\=True_, _called\_in\_iid\=False_) → List\[Mapping\[str, List\[numpy.ndarray\]\]\][](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/dataset/index.html#id29 "Link to this definition")
FedEval.dataset.shuffle(_X_, _Y_)[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/dataset/index.html#id30 "Link to this definition")
Input (X, Y) pairs, shuffle and return it.
_class_ FedEval.dataset.celeba[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/dataset/index.html#FedEval.dataset.celeba "Link to this definition")
Bases: [`FedEval.dataset.FedDataBase.FedData`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/dataset/FedDataBase/index.html#FedEval.dataset.FedDataBase.FedData "FedEval.dataset.FedDataBase.FedData")
CelebA Median: Top 1000 clients
load\_data()[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/dataset/index.html#FedEval.dataset.celeba.load_data "Link to this definition")
_class_ FedEval.dataset.FedData[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/dataset/index.html#id31 "Link to this definition")
By default, FedData produces datasets for horizontal federated learning
_property_ need\_regenerate_: bool_[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/dataset/index.html#id32 "Link to this definition")
\_load\_and\_process\_data()[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/dataset/index.html#id33 "Link to this definition")
_abstract_ load\_data()[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/dataset/index.html#id34 "Link to this definition")
iid\_data(_save\_file\=True_)[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/dataset/index.html#id35 "Link to this definition")
\_save\_dataset\_files(_dataset: List\[Mapping\[str, List\[numpy.ndarray\]\]\]_) → None[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/dataset/index.html#id36 "Link to this definition")
non\_iid\_data(_save\_file\=True_, _called\_in\_iid\=False_) → List\[Mapping\[str, List\[numpy.ndarray\]\]\][](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/dataset/index.html#id37 "Link to this definition")
FedEval.dataset.shuffle(_X_, _Y_)[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/dataset/index.html#id38 "Link to this definition")
Input (X, Y) pairs, shuffle and return it.
_class_ FedEval.dataset.femnist[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/dataset/index.html#FedEval.dataset.femnist "Link to this definition")
Bases: [`FedEval.dataset.FedDataBase.FedData`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/dataset/FedDataBase/index.html#FedEval.dataset.FedDataBase.FedData "FedEval.dataset.FedDataBase.FedData")
FEMnistLarge, 3500 Clients FEMnistMedian, 1000 Clients FEMnistSmall, 100 Clients
load\_data()[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/dataset/index.html#FedEval.dataset.femnist.load_data "Link to this definition")
FedEval.dataset.get\_data\_shape(_dataset\_name: str_)[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/dataset/index.html#FedEval.dataset.get_data_shape "Link to this definition")
---
# 5.1.1.8. FedEval.strategy — FedEval documentation
* [](https://fedeval.readthedocs.io/en/latest/index.html)
* [5\. API Reference](https://fedeval.readthedocs.io/en/latest/autoapi/index.html)
* [5.1. `FedEval`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/index.html)
* 5.1.1.8. `FedEval.strategy`
* [Edit on GitHub](https://github.com/Di-Chai/FedEval/blob/master/docs/autoapi/FedEval/strategy/index.rst)
* * *
5.1.1.8. [`FedEval.strategy`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/strategy/index.html#module-FedEval.strategy "FedEval.strategy")
[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/strategy/index.html#module-FedEval.strategy "Link to this heading")
========================================================================================================================================================================================================================================================================================
5.1.1.8.1. Submodules[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/strategy/index.html#submodules "Link to this heading")
-----------------------------------------------------------------------------------------------------------------------------------------
* [5.1.1.8.1.1. `FedEval.strategy.FedAvg`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/strategy/FedAvg/index.html)
* [5.1.1.8.1.2. `FedEval.strategy.FedOpt`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/strategy/FedOpt/index.html)
* [5.1.1.8.1.3. `FedEval.strategy.FedProx`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/strategy/FedProx/index.html)
* [5.1.1.8.1.4. `FedEval.strategy.FedSCA`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/strategy/FedSCA/index.html)
* [5.1.1.8.1.5. `FedEval.strategy.FedSTC`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/strategy/FedSTC/index.html)
* [5.1.1.8.1.6. `FedEval.strategy.FedSVD`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/strategy/FedSVD/index.html)
* [5.1.1.8.1.7. `FedEval.strategy.FederatedStrategy`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/strategy/FederatedStrategy/index.html)
* [5.1.1.8.1.8. `FedEval.strategy.FetchSGD`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/strategy/FetchSGD/index.html)
* [5.1.1.8.1.9. `FedEval.strategy.MFedAvg`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/strategy/MFedAvg/index.html)
* [5.1.1.8.1.10. `FedEval.strategy.PaillierAggregation`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/strategy/PaillierAggregation/index.html)
* [5.1.1.8.1.11. `FedEval.strategy.SecureAggregation`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/strategy/SecureAggregation/index.html)
* [5.1.1.8.1.12. `FedEval.strategy.base`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/strategy/base/index.html)
* [5.1.1.8.1.13. `FedEval.strategy.build_in`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/strategy/build_in/index.html)
5.1.1.8.2. Package Contents[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/strategy/index.html#package-contents "Link to this heading")
-----------------------------------------------------------------------------------------------------------------------------------------------------
### 5.1.1.8.2.1. Classes[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/strategy/index.html#classes "Link to this heading")
| | |
| --- | --- |
| [`FedAvg`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/strategy/index.html#FedEval.strategy.FedAvg "FedEval.strategy.FedAvg") | the basic class of federated strategies. |
| [`FedSGD`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/strategy/index.html#FedEval.strategy.FedSGD "FedEval.strategy.FedSGD") | the basic class of federated strategies. |
| [`FedSTC`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/strategy/index.html#FedEval.strategy.FedSTC "FedEval.strategy.FedSTC") | the basic class of federated strategies. |
| [`FedProx`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/strategy/index.html#FedEval.strategy.FedProx "FedEval.strategy.FedProx") | the basic class of federated strategies. |
| [`FedOpt`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/strategy/index.html#FedEval.strategy.FedOpt "FedEval.strategy.FedOpt") | the basic class of federated strategies. |
| [`FedSCA`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/strategy/index.html#FedEval.strategy.FedSCA "FedEval.strategy.FedSCA") | |
| [`MFedAvg`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/strategy/index.html#FedEval.strategy.MFedAvg "FedEval.strategy.MFedAvg") | |
| [`MFedSGD`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/strategy/index.html#FedEval.strategy.MFedSGD "FedEval.strategy.MFedSGD") | the basic class of federated strategies. |
| [`FedSVD`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/strategy/index.html#FedEval.strategy.FedSVD "FedEval.strategy.FedSVD") | |
| [`SecureAggregation`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/strategy/index.html#FedEval.strategy.SecureAggregation "FedEval.strategy.SecureAggregation") | the basic class of federated strategies. |
| [`PaillierAggregation`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/strategy/index.html#FedEval.strategy.PaillierAggregation "FedEval.strategy.PaillierAggregation") | |
| [`FedStrategy`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/strategy/index.html#FedEval.strategy.FedStrategy "FedEval.strategy.FedStrategy") | the basic class of federated strategies. |
| [`FedStrategyHostInterface`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/strategy/index.html#FedEval.strategy.FedStrategyHostInterface "FedEval.strategy.FedStrategyHostInterface") | |
| [`FedStrategyInterface`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/strategy/index.html#FedEval.strategy.FedStrategyInterface "FedEval.strategy.FedStrategyInterface") | the interface of federated strategies. |
| [`FedStrategyPeerInterface`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/strategy/index.html#FedEval.strategy.FedStrategyPeerInterface "FedEval.strategy.FedStrategyPeerInterface") | |
_class_ FedEval.strategy.FedAvg(_\*args_, _\*\*kwargs_)[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/strategy/index.html#FedEval.strategy.FedAvg "Link to this definition")
Bases: [`FedEval.strategy.FederatedStrategy.FedStrategy`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/strategy/FederatedStrategy/index.html#FedEval.strategy.FederatedStrategy.FedStrategy "FedEval.strategy.FederatedStrategy.FedStrategy")
the basic class of federated strategies.
host\_select\_train\_clients(_ready\_clients_)[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/strategy/index.html#FedEval.strategy.FedAvg.host_select_train_clients "Link to this definition")
select clients from the given ones for training purpose.
Parameters:
**ready\_clients** (_List__\[__ClientId__\]_) – the id list of clients that are ready for training.
Raises:
**NotImplementedError** – raised when called but not overriden.
Returns:
the id list of the selected clients.
Return type:
List\[ClientId\]
host\_select\_evaluate\_clients(_ready\_clients_)[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/strategy/index.html#FedEval.strategy.FedAvg.host_select_evaluate_clients "Link to this definition")
select clients from the given ones for evaluation purpose.
Parameters:
**ready\_clients** (_List__\[__ClientId__\]_) – the id list of clients that are ready for evaluaion.
Raises:
**NotImplementedError** – raised when called but not overriden.
Returns:
the id list of the selected clients.
Return type:
List\[ClientId\]
_class_ FedEval.strategy.FedSGD(_\*args_, _\*\*kwargs_)[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/strategy/index.html#FedEval.strategy.FedSGD "Link to this definition")
Bases: [`FedAvg`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/strategy/index.html#FedEval.strategy.FedAvg "FedEval.strategy.FedAvg")
the basic class of federated strategies.
compute\_gradients(_x_, _y_)[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/strategy/index.html#FedEval.strategy.FedSGD.compute_gradients "Link to this definition")
host\_select\_train\_clients(_ready\_clients_)[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/strategy/index.html#FedEval.strategy.FedSGD.host_select_train_clients "Link to this definition")
select clients from the given ones for training purpose.
Parameters:
**ready\_clients** (_List__\[__ClientId__\]_) – the id list of clients that are ready for training.
Raises:
**NotImplementedError** – raised when called but not overriden.
Returns:
the id list of the selected clients.
Return type:
List\[ClientId\]
host\_select\_evaluate\_clients(_ready\_clients_)[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/strategy/index.html#FedEval.strategy.FedSGD.host_select_evaluate_clients "Link to this definition")
select clients from the given ones for evaluation purpose.
Parameters:
**ready\_clients** (_List__\[__ClientId__\]_) – the id list of clients that are ready for evaluaion.
Raises:
**NotImplementedError** – raised when called but not overriden.
Returns:
the id list of the selected clients.
Return type:
List\[ClientId\]
fit\_on\_local\_data()[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/strategy/index.html#FedEval.strategy.FedSGD.fit_on_local_data "Link to this definition")
fit model with local data at client side.
Called by the selected clients.
Raises:
**NotImplementedError** – raised when called but not overriden.
Returns:
TODO(fgh)
_class_ FedEval.strategy.FedSTC(_\*\*kwargs_)[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/strategy/index.html#FedEval.strategy.FedSTC "Link to this definition")
Bases: [`FedEval.strategy.FedAvg.FedAvg`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/strategy/FedAvg/index.html#FedEval.strategy.FedAvg.FedAvg "FedEval.strategy.FedAvg.FedAvg")
the basic class of federated strategies.
_static_ stc(_input\_tensor_, _sparsity\=0.01_)[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/strategy/index.html#FedEval.strategy.FedSTC.stc "Link to this definition")
\_init\_residual()[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/strategy/index.html#FedEval.strategy.FedSTC._init_residual "Link to this definition")
\_tensor\_to\_vector(_input\_tensor_)[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/strategy/index.html#FedEval.strategy.FedSTC._tensor_to_vector "Link to this definition")
\_vector\_to\_tensor(_input\_vector_)[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/strategy/index.html#FedEval.strategy.FedSTC._vector_to_tensor "Link to this definition")
_static_ compress(_input\_tensor_)[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/strategy/index.html#FedEval.strategy.FedSTC.compress "Link to this definition")
retrieve\_local\_upload\_info()[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/strategy/index.html#FedEval.strategy.FedSTC.retrieve_local_upload_info "Link to this definition")
return the information aggregated from local model for uploading to the central server.
Called by the selected clients.
Raises:
**NotImplementedError** – raised when called but not overriden.
Returns:
the local model weights/params.
Return type:
ModelWeights
set\_host\_params\_to\_local(_host\_params_, _current\_round_)[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/strategy/index.html#FedEval.strategy.FedSTC.set_host_params_to_local "Link to this definition")
update the current local ML/DL model’s params with params received from the central server.
Parameters:
* **host\_params** (_ModelWeights_) – params received from the central server.
* **current\_round** (_int_) – the current round number
Raises:
**NotImplementedError** – raised when called but not overriden.
update\_host\_params(_client\_params_, _aggregate\_weights_)[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/strategy/index.html#FedEval.strategy.FedSTC.update_host_params "Link to this definition")
update central server’s model params/weights with the aggregated params received from clients.
Parameters:
* **client\_params** (_Iterable__\[__ModelWeights__\]_) – the weights form different clients, ordered like \[params1, params2, …\]
* **aggregate\_weights** (_Iterable__\[__Union__\[__float__,_ _int__\]__\]_) – aggregate weights of different clients, usually set according to the clients’ training sample size. E.g., A, B, and C have 10, 20, and 30 images, then the aggregate\_weights can be \[1/6, 1/3, 1/2\] or \[10, 20, 30\].
Raises:
**NotImplementedError** – raised when called but not overriden.
retrieve\_host\_download\_info()[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/strategy/index.html#FedEval.strategy.FedSTC.retrieve_host_download_info "Link to this definition")
get the host download information,
e.g., model params/weights from its machine/deep learning model.
Raises:
**NotImplementedError** – raised when called but not overriden.
Returns:
the weights/params of its inner machine/deep learning model. TODO(fgh): the meaning of the str in the return type/
Return type:
ModelWeights
_class_ FedEval.strategy.FedProx(_\*args_, _\*\*kwargs_)[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/strategy/index.html#FedEval.strategy.FedProx "Link to this definition")
Bases: [`FedEval.strategy.FedAvg.FedAvg`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/strategy/FedAvg/index.html#FedEval.strategy.FedAvg.FedAvg "FedEval.strategy.FedAvg.FedAvg")
the basic class of federated strategies.
fit\_on\_local\_data()[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/strategy/index.html#FedEval.strategy.FedProx.fit_on_local_data "Link to this definition")
fit model with local data at client side.
Called by the selected clients.
Raises:
**NotImplementedError** – raised when called but not overriden.
Returns:
TODO(fgh)
_class_ FedEval.strategy.FedOpt(_\*args_, _\*\*kwags_)[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/strategy/index.html#FedEval.strategy.FedOpt "Link to this definition")
Bases: [`FedEval.strategy.FedAvg.FedAvg`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/strategy/FedAvg/index.html#FedEval.strategy.FedAvg.FedAvg "FedEval.strategy.FedAvg.FedAvg")
the basic class of federated strategies.
retrieve\_local\_upload\_info()[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/strategy/index.html#FedEval.strategy.FedOpt.retrieve_local_upload_info "Link to this definition")
return the information aggregated from local model for uploading to the central server.
Called by the selected clients.
Raises:
**NotImplementedError** – raised when called but not overriden.
Returns:
the local model weights/params.
Return type:
ModelWeights
update\_host\_params(_client\_params_, _aggregate\_weights_)[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/strategy/index.html#FedEval.strategy.FedOpt.update_host_params "Link to this definition")
update central server’s model params/weights with the aggregated params received from clients.
Parameters:
* **client\_params** (_Iterable__\[__ModelWeights__\]_) – the weights form different clients, ordered like \[params1, params2, …\]
* **aggregate\_weights** (_Iterable__\[__Union__\[__float__,_ _int__\]__\]_) – aggregate weights of different clients, usually set according to the clients’ training sample size. E.g., A, B, and C have 10, 20, and 30 images, then the aggregate\_weights can be \[1/6, 1/3, 1/2\] or \[10, 20, 30\].
Raises:
**NotImplementedError** – raised when called but not overriden.
_class_ FedEval.strategy.FedSCA(_\*\*kwargs_)[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/strategy/index.html#FedEval.strategy.FedSCA "Link to this definition")
Bases: [`FedEval.strategy.FedAvg.FedAvg`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/strategy/FedAvg/index.html#FedEval.strategy.FedAvg.FedAvg "FedEval.strategy.FedAvg.FedAvg")
the basic class of federated strategies.
retrieve\_host\_download\_info()[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/strategy/index.html#FedEval.strategy.FedSCA.retrieve_host_download_info "Link to this definition")
get the host download information,
e.g., model params/weights from its machine/deep learning model.
Raises:
**NotImplementedError** – raised when called but not overriden.
Returns:
the weights/params of its inner machine/deep learning model. TODO(fgh): the meaning of the str in the return type/
Return type:
ModelWeights
set\_host\_params\_to\_local(_host\_params_, _current\_round_)[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/strategy/index.html#FedEval.strategy.FedSCA.set_host_params_to_local "Link to this definition")
update the current local ML/DL model’s params with params received from the central server.
Parameters:
* **host\_params** (_ModelWeights_) – params received from the central server.
* **current\_round** (_int_) – the current round number
Raises:
**NotImplementedError** – raised when called but not overriden.
update\_host\_params(_client\_params_, _aggregate\_weights_)[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/strategy/index.html#FedEval.strategy.FedSCA.update_host_params "Link to this definition")
update central server’s model params/weights with the aggregated params received from clients.
Parameters:
* **client\_params** (_Iterable__\[__ModelWeights__\]_) – the weights form different clients, ordered like \[params1, params2, …\]
* **aggregate\_weights** (_Iterable__\[__Union__\[__float__,_ _int__\]__\]_) – aggregate weights of different clients, usually set according to the clients’ training sample size. E.g., A, B, and C have 10, 20, and 30 images, then the aggregate\_weights can be \[1/6, 1/3, 1/2\] or \[10, 20, 30\].
Raises:
**NotImplementedError** – raised when called but not overriden.
fit\_on\_local\_data()[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/strategy/index.html#FedEval.strategy.FedSCA.fit_on_local_data "Link to this definition")
fit model with local data at client side.
Called by the selected clients.
Raises:
**NotImplementedError** – raised when called but not overriden.
Returns:
TODO(fgh)
retrieve\_local\_upload\_info()[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/strategy/index.html#FedEval.strategy.FedSCA.retrieve_local_upload_info "Link to this definition")
return the information aggregated from local model for uploading to the central server.
Called by the selected clients.
Raises:
**NotImplementedError** – raised when called but not overriden.
Returns:
the local model weights/params.
Return type:
ModelWeights
_class_ FedEval.strategy.MFedAvg(_\*\*kwargs_)[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/strategy/index.html#FedEval.strategy.MFedAvg "Link to this definition")
Bases: [`FedEval.strategy.FedAvg.FedAvg`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/strategy/FedAvg/index.html#FedEval.strategy.FedAvg.FedAvg "FedEval.strategy.FedAvg.FedAvg")
the basic class of federated strategies.
update\_host\_params(_client\_params_, _aggregate\_weights_)[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/strategy/index.html#FedEval.strategy.MFedAvg.update_host_params "Link to this definition")
update central server’s model params/weights with the aggregated params received from clients.
Parameters:
* **client\_params** (_Iterable__\[__ModelWeights__\]_) – the weights form different clients, ordered like \[params1, params2, …\]
* **aggregate\_weights** (_Iterable__\[__Union__\[__float__,_ _int__\]__\]_) – aggregate weights of different clients, usually set according to the clients’ training sample size. E.g., A, B, and C have 10, 20, and 30 images, then the aggregate\_weights can be \[1/6, 1/3, 1/2\] or \[10, 20, 30\].
Raises:
**NotImplementedError** – raised when called but not overriden.
_class_ FedEval.strategy.MFedSGD(_\*\*kwargs_)[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/strategy/index.html#FedEval.strategy.MFedSGD "Link to this definition")
Bases: [`MFedAvg`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/strategy/index.html#FedEval.strategy.MFedAvg "FedEval.strategy.MFedAvg")
the basic class of federated strategies.
_class_ FedEval.strategy.FedSVD(_\*args_, _\*\*kwargs_)[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/strategy/index.html#FedEval.strategy.FedSVD "Link to this definition")
Bases: [`FedEval.strategy.FederatedStrategy.FedStrategy`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/strategy/FederatedStrategy/index.html#FedEval.strategy.FederatedStrategy.FedStrategy "FedEval.strategy.FederatedStrategy.FedStrategy")
the basic class of federated strategies.
\_log\_hardware\_usage()[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/strategy/index.html#FedEval.strategy.FedSVD._log_hardware_usage "Link to this definition")
\_init\_model()[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/strategy/index.html#FedEval.strategy.FedSVD._init_model "Link to this definition")
host\_select\_train\_clients(_ready\_clients: List\[FedEval.config.ClientId\]_) → List\[FedEval.config.ClientId\][](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/strategy/index.html#FedEval.strategy.FedSVD.host_select_train_clients "Link to this definition")
select clients from the given ones for training purpose.
Parameters:
**ready\_clients** (_List__\[__ClientId__\]_) – the id list of clients that are ready for training.
Raises:
**NotImplementedError** – raised when called but not overriden.
Returns:
the id list of the selected clients.
Return type:
List\[ClientId\]
retrieve\_host\_download\_info()[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/strategy/index.html#FedEval.strategy.FedSVD.retrieve_host_download_info "Link to this definition")
get the host download information,
e.g., model params/weights from its machine/deep learning model.
Raises:
**NotImplementedError** – raised when called but not overriden.
Returns:
the weights/params of its inner machine/deep learning model. TODO(fgh): the meaning of the str in the return type/
Return type:
ModelWeights
update\_host\_params(_client\_params_, _\*args_)[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/strategy/index.html#FedEval.strategy.FedSVD.update_host_params "Link to this definition")
update central server’s model params/weights with the aggregated params received from clients.
Parameters:
* **client\_params** (_Iterable__\[__ModelWeights__\]_) – the weights form different clients, ordered like \[params1, params2, …\]
* **aggregate\_weights** (_Iterable__\[__Union__\[__float__,_ _int__\]__\]_) – aggregate weights of different clients, usually set according to the clients’ training sample size. E.g., A, B, and C have 10, 20, and 30 images, then the aggregate\_weights can be \[1/6, 1/3, 1/2\] or \[10, 20, 30\].
Raises:
**NotImplementedError** – raised when called but not overriden.
safe\_memmap\_matmul(_a_, _b_, _step\_size\=1000_)[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/strategy/index.html#FedEval.strategy.FedSVD.safe_memmap_matmul "Link to this definition")
\_server\_svd(_data\_matrix_)[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/strategy/index.html#FedEval.strategy.FedSVD._server_svd "Link to this definition")
set\_host\_params\_to\_local(_host\_params_, _\*\*kwargs_)[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/strategy/index.html#FedEval.strategy.FedSVD.set_host_params_to_local "Link to this definition")
update the current local ML/DL model’s params with params received from the central server.
Parameters:
* **host\_params** (_ModelWeights_) – params received from the central server.
* **current\_round** (_int_) – the current round number
Raises:
**NotImplementedError** – raised when called but not overriden.
\_generate\_masked\_data\_in\_secure\_agg(_shape_, _base\=None_)[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/strategy/index.html#FedEval.strategy.FedSVD._generate_masked_data_in_secure_agg "Link to this definition")
fit\_on\_local\_data()[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/strategy/index.html#FedEval.strategy.FedSVD.fit_on_local_data "Link to this definition")
fit model with local data at client side.
Called by the selected clients.
Raises:
**NotImplementedError** – raised when called but not overriden.
Returns:
TODO(fgh)
local\_evaluate()[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/strategy/index.html#FedEval.strategy.FedSVD.local_evaluate "Link to this definition")
evaluate and test the model received from the central server.
Called by the selected clients.
Raises:
**NotImplementedError** – raised when called but not overriden.
Returns:
evaluation & test metrics.
Return type:
Mapping\[str, Union\[int, float\]\]
client\_exit\_job(_client_)[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/strategy/index.html#FedEval.strategy.FedSVD.client_exit_job "Link to this definition")
do self-defined finishing jobs before the shutdown of the local clients.
Parameters:
**client** – TODO(fgh)
Raises:
**NotImplementedError** – raised when called but not overriden.
retrieve\_local\_upload\_info()[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/strategy/index.html#FedEval.strategy.FedSVD.retrieve_local_upload_info "Link to this definition")
return the information aggregated from local model for uploading to the central server.
Called by the selected clients.
Raises:
**NotImplementedError** – raised when called but not overriden.
Returns:
the local model weights/params.
Return type:
ModelWeights
host\_exit\_job(_host_)[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/strategy/index.html#FedEval.strategy.FedSVD.host_exit_job "Link to this definition")
do self-defined finishing jobs before the shutdown of the central server.
Parameters:
**host** – TODO(fgh)
Raises:
**NotImplementedError** – raised when called but not overriden.
_class_ FedEval.strategy.SecureAggregation(_\*\*kwargs_)[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/strategy/index.html#FedEval.strategy.SecureAggregation "Link to this definition")
Bases: [`FedEval.strategy.FederatedStrategy.FedStrategy`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/strategy/FederatedStrategy/index.html#FedEval.strategy.FederatedStrategy.FedStrategy "FedEval.strategy.FederatedStrategy.FedStrategy")
the basic class of federated strategies.
host\_select\_train\_clients(_ready\_clients_)[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/strategy/index.html#FedEval.strategy.SecureAggregation.host_select_train_clients "Link to this definition")
select clients from the given ones for training purpose.
Parameters:
**ready\_clients** (_List__\[__ClientId__\]_) – the id list of clients that are ready for training.
Raises:
**NotImplementedError** – raised when called but not overriden.
Returns:
the id list of the selected clients.
Return type:
List\[ClientId\]
retrieve\_host\_download\_info()[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/strategy/index.html#FedEval.strategy.SecureAggregation.retrieve_host_download_info "Link to this definition")
get the host download information,
e.g., model params/weights from its machine/deep learning model.
Raises:
**NotImplementedError** – raised when called but not overriden.
Returns:
the weights/params of its inner machine/deep learning model. TODO(fgh): the meaning of the str in the return type/
Return type:
ModelWeights
update\_host\_params(_client\_params_, _aggregate\_weights_)[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/strategy/index.html#FedEval.strategy.SecureAggregation.update_host_params "Link to this definition")
update central server’s model params/weights with the aggregated params received from clients.
Parameters:
* **client\_params** (_Iterable__\[__ModelWeights__\]_) – the weights form different clients, ordered like \[params1, params2, …\]
* **aggregate\_weights** (_Iterable__\[__Union__\[__float__,_ _int__\]__\]_) – aggregate weights of different clients, usually set according to the clients’ training sample size. E.g., A, B, and C have 10, 20, and 30 images, then the aggregate\_weights can be \[1/6, 1/3, 1/2\] or \[10, 20, 30\].
Raises:
**NotImplementedError** – raised when called but not overriden.
set\_host\_params\_to\_local(_host\_params_, _current\_round: int_)[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/strategy/index.html#FedEval.strategy.SecureAggregation.set_host_params_to_local "Link to this definition")
update the current local ML/DL model’s params with params received from the central server.
Parameters:
* **host\_params** (_ModelWeights_) – params received from the central server.
* **current\_round** (_int_) – the current round number
Raises:
**NotImplementedError** – raised when called but not overriden.
fit\_on\_local\_data()[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/strategy/index.html#FedEval.strategy.SecureAggregation.fit_on_local_data "Link to this definition")
fit model with local data at client side.
Called by the selected clients.
Raises:
**NotImplementedError** – raised when called but not overriden.
Returns:
TODO(fgh)
retrieve\_local\_upload\_info()[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/strategy/index.html#FedEval.strategy.SecureAggregation.retrieve_local_upload_info "Link to this definition")
return the information aggregated from local model for uploading to the central server.
Called by the selected clients.
Raises:
**NotImplementedError** – raised when called but not overriden.
Returns:
the local model weights/params.
Return type:
ModelWeights
_class_ FedEval.strategy.PaillierAggregation(_\*\*kwargs_)[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/strategy/index.html#FedEval.strategy.PaillierAggregation "Link to this definition")
Bases: [`FedEval.strategy.FederatedStrategy.FedStrategy`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/strategy/FederatedStrategy/index.html#FedEval.strategy.FederatedStrategy.FedStrategy "FedEval.strategy.FederatedStrategy.FedStrategy")
the basic class of federated strategies.
host\_select\_train\_clients(_ready\_clients_)[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/strategy/index.html#FedEval.strategy.PaillierAggregation.host_select_train_clients "Link to this definition")
select clients from the given ones for training purpose.
Parameters:
**ready\_clients** (_List__\[__ClientId__\]_) – the id list of clients that are ready for training.
Raises:
**NotImplementedError** – raised when called but not overriden.
Returns:
the id list of the selected clients.
Return type:
List\[ClientId\]
retrieve\_host\_download\_info()[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/strategy/index.html#FedEval.strategy.PaillierAggregation.retrieve_host_download_info "Link to this definition")
get the host download information,
e.g., model params/weights from its machine/deep learning model.
Raises:
**NotImplementedError** – raised when called but not overriden.
Returns:
the weights/params of its inner machine/deep learning model. TODO(fgh): the meaning of the str in the return type/
Return type:
ModelWeights
update\_host\_params(_client\_params_, _aggregate\_weights_) → None[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/strategy/index.html#FedEval.strategy.PaillierAggregation.update_host_params "Link to this definition")
update central server’s model params/weights with the aggregated params received from clients.
Parameters:
* **client\_params** (_Iterable__\[__ModelWeights__\]_) – the weights form different clients, ordered like \[params1, params2, …\]
* **aggregate\_weights** (_Iterable__\[__Union__\[__float__,_ _int__\]__\]_) – aggregate weights of different clients, usually set according to the clients’ training sample size. E.g., A, B, and C have 10, 20, and 30 images, then the aggregate\_weights can be \[1/6, 1/3, 1/2\] or \[10, 20, 30\].
Raises:
**NotImplementedError** – raised when called but not overriden.
set\_host\_params\_to\_local(_host\_params_, _current\_round: int_)[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/strategy/index.html#FedEval.strategy.PaillierAggregation.set_host_params_to_local "Link to this definition")
update the current local ML/DL model’s params with params received from the central server.
Parameters:
* **host\_params** (_ModelWeights_) – params received from the central server.
* **current\_round** (_int_) – the current round number
Raises:
**NotImplementedError** – raised when called but not overriden.
fit\_on\_local\_data()[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/strategy/index.html#FedEval.strategy.PaillierAggregation.fit_on_local_data "Link to this definition")
fit model with local data at client side.
Called by the selected clients.
Raises:
**NotImplementedError** – raised when called but not overriden.
Returns:
TODO(fgh)
retrieve\_local\_upload\_info()[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/strategy/index.html#FedEval.strategy.PaillierAggregation.retrieve_local_upload_info "Link to this definition")
return the information aggregated from local model for uploading to the central server.
Called by the selected clients.
Raises:
**NotImplementedError** – raised when called but not overriden.
Returns:
the local model weights/params.
Return type:
ModelWeights
_class_ FedEval.strategy.FedStrategy(_client\_id\=None_, _param\_parser: type \= ParamParser_, _logger\=None_)[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/strategy/index.html#FedEval.strategy.FedStrategy "Link to this definition")
Bases: [`FedStrategyInterface`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/strategy/index.html#FedEval.strategy.FedStrategyInterface "FedEval.strategy.FedStrategyInterface")
the basic class of federated strategies.
_property_ client\_id[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/strategy/index.html#FedEval.strategy.FedStrategy.client_id "Link to this definition")
Client ID
Type:
Returns
_property_ param\_parser_: [FedEval.utils.ParamParserInterface](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/utils/index.html#FedEval.utils.ParamParserInterface "FedEval.utils.ParamParserInterface")
_[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/strategy/index.html#FedEval.strategy.FedStrategy.param_parser "Link to this definition")
the getter of param\_parser.
Raises:
**NotImplementedError** – raised when called but not overriden.
Returns:
self.\_param\_parser
Return type:
[ParamParserInterface](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/utils/index.html#FedEval.utils.ParamParserInterface "FedEval.utils.ParamParserInterface")
_property_ host\_params\_type[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/strategy/index.html#FedEval.strategy.FedStrategy.host_params_type "Link to this definition")
Returns the same parameters for all parties or personalized ML model
_property_ train\_selected\_clients[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/strategy/index.html#FedEval.strategy.FedStrategy.train_selected_clients "Link to this definition")
Returns the selected clients for training
_property_ host\_params[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/strategy/index.html#FedEval.strategy.FedStrategy.host_params "Link to this definition")
Host parameters
Type:
Returns
_property_ eval\_selected\_clients[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/strategy/index.html#FedEval.strategy.FedStrategy.eval_selected_clients "Link to this definition")
Returns the selected clients for evaluation
_property_ stop[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/strategy/index.html#FedEval.strategy.FedStrategy.stop "Link to this definition")
Server-side train stop flag
set\_logger(_logger_) → None[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/strategy/index.html#FedEval.strategy.FedStrategy.set_logger "Link to this definition")
the setter of logger of this federated learning.
Parameters:
**logger** – an external logger.
Raises:
**NotImplementedError** – raised when called but not overriden.
\_init\_model()[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/strategy/index.html#FedEval.strategy.FedStrategy._init_model "Link to this definition")
\_init\_data() → None[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/strategy/index.html#FedEval.strategy.FedStrategy._init_data "Link to this definition")
\_init\_states()[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/strategy/index.html#FedEval.strategy.FedStrategy._init_states "Link to this definition")
\_config\_callback()[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/strategy/index.html#FedEval.strategy.FedStrategy._config_callback "Link to this definition")
\_has\_callback() → bool[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/strategy/index.html#FedEval.strategy.FedStrategy._has_callback "Link to this definition")
retrieve\_host\_download\_info() → FedEval.aggregator.ModelWeights[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/strategy/index.html#FedEval.strategy.FedStrategy.retrieve_host_download_info "Link to this definition")
get the host download information,
e.g., model params/weights from its machine/deep learning model.
Raises:
**NotImplementedError** – raised when called but not overriden.
Returns:
the weights/params of its inner machine/deep learning model. TODO(fgh): the meaning of the str in the return type/
Return type:
ModelWeights
update\_host\_params(_client\_params_, _aggregate\_weights_) → None[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/strategy/index.html#FedEval.strategy.FedStrategy.update_host_params "Link to this definition")
update central server’s model params/weights with the aggregated params received from clients.
Parameters:
* **client\_params** (_Iterable__\[__ModelWeights__\]_) – the weights form different clients, ordered like \[params1, params2, …\]
* **aggregate\_weights** (_Iterable__\[__Union__\[__float__,_ _int__\]__\]_) – aggregate weights of different clients, usually set according to the clients’ training sample size. E.g., A, B, and C have 10, 20, and 30 images, then the aggregate\_weights can be \[1/6, 1/3, 1/2\] or \[10, 20, 30\].
Raises:
**NotImplementedError** – raised when called but not overriden.
host\_exit\_job(_host_)[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/strategy/index.html#FedEval.strategy.FedStrategy.host_exit_job "Link to this definition")
do self-defined finishing jobs before the shutdown of the central server.
Parameters:
**host** – TODO(fgh)
Raises:
**NotImplementedError** – raised when called but not overriden.
host\_select\_train\_clients(_ready\_clients: List\[FedEval.config.ClientId\]_) → List\[FedEval.config.ClientId\][](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/strategy/index.html#FedEval.strategy.FedStrategy.host_select_train_clients "Link to this definition")
select clients from the given ones for training purpose.
Parameters:
**ready\_clients** (_List__\[__ClientId__\]_) – the id list of clients that are ready for training.
Raises:
**NotImplementedError** – raised when called but not overriden.
Returns:
the id list of the selected clients.
Return type:
List\[ClientId\]
host\_select\_evaluate\_clients(_ready\_clients: List\[FedEval.config.ClientId\]_) → List\[FedEval.config.ClientId\][](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/strategy/index.html#FedEval.strategy.FedStrategy.host_select_evaluate_clients "Link to this definition")
select clients from the given ones for evaluation purpose.
Parameters:
**ready\_clients** (_List__\[__ClientId__\]_) – the id list of clients that are ready for evaluaion.
Raises:
**NotImplementedError** – raised when called but not overriden.
Returns:
the id list of the selected clients.
Return type:
List\[ClientId\]
set\_host\_params\_to\_local(_host\_params: FedEval.aggregator.ModelWeights_, _current\_round: int_)[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/strategy/index.html#FedEval.strategy.FedStrategy.set_host_params_to_local "Link to this definition")
update the current local ML/DL model’s params with params received from the central server.
Parameters:
* **host\_params** (_ModelWeights_) – params received from the central server.
* **current\_round** (_int_) – the current round number
Raises:
**NotImplementedError** – raised when called but not overriden.
fit\_on\_local\_data()[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/strategy/index.html#FedEval.strategy.FedStrategy.fit_on_local_data "Link to this definition")
fit model with local data at client side.
Called by the selected clients.
Raises:
**NotImplementedError** – raised when called but not overriden.
Returns:
TODO(fgh)
\_retrieve\_local\_params()[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/strategy/index.html#FedEval.strategy.FedStrategy._retrieve_local_params "Link to this definition")
retrieve\_local\_upload\_info() → FedEval.aggregator.ModelWeights[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/strategy/index.html#FedEval.strategy.FedStrategy.retrieve_local_upload_info "Link to this definition")
return the information aggregated from local model for uploading to the central server.
Called by the selected clients.
Raises:
**NotImplementedError** – raised when called but not overriden.
Returns:
the local model weights/params.
Return type:
ModelWeights
local\_evaluate() → Mapping\[str, int | float\][](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/strategy/index.html#FedEval.strategy.FedStrategy.local_evaluate "Link to this definition")
evaluate and test the model received from the central server.
Called by the selected clients.
Raises:
**NotImplementedError** – raised when called but not overriden.
Returns:
evaluation & test metrics.
Return type:
Mapping\[str, Union\[int, float\]\]
client\_exit\_job(_client_)[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/strategy/index.html#FedEval.strategy.FedStrategy.client_exit_job "Link to this definition")
do self-defined finishing jobs before the shutdown of the local clients.
Parameters:
**client** – TODO(fgh)
Raises:
**NotImplementedError** – raised when called but not overriden.
_class_ FedEval.strategy.FedStrategyHostInterface[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/strategy/index.html#FedEval.strategy.FedStrategyHostInterface "Link to this definition")
_abstract property_ host\_params[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/strategy/index.html#FedEval.strategy.FedStrategyHostInterface.host_params "Link to this definition")
Host parameters
Type:
Returns
_abstract property_ host\_params\_type[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/strategy/index.html#FedEval.strategy.FedStrategyHostInterface.host_params_type "Link to this definition")
Returns the same parameters for all parties or personalized ML model
_abstract property_ stop[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/strategy/index.html#FedEval.strategy.FedStrategyHostInterface.stop "Link to this definition")
Server-side train stop flag
_abstract property_ train\_selected\_clients[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/strategy/index.html#FedEval.strategy.FedStrategyHostInterface.train_selected_clients "Link to this definition")
Returns the selected clients for training
_abstract property_ eval\_selected\_clients[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/strategy/index.html#FedEval.strategy.FedStrategyHostInterface.eval_selected_clients "Link to this definition")
Returns the selected clients for evaluation
_abstract_ retrieve\_host\_download\_info() → Tuple\[FedEval.aggregator.ModelWeights, str\][](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/strategy/index.html#FedEval.strategy.FedStrategyHostInterface.retrieve_host_download_info "Link to this definition")
get the host download information,
e.g., model params/weights from its machine/deep learning model.
Raises:
**NotImplementedError** – raised when called but not overriden.
Returns:
the weights/params of its inner machine/deep learning model. TODO(fgh): the meaning of the str in the return type/
Return type:
ModelWeights
_abstract_ update\_host\_params(_client\_params: Iterable\[FedEval.aggregator.ModelWeights\]_, _aggregate\_weights: Iterable\[float | int\]_) → None[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/strategy/index.html#FedEval.strategy.FedStrategyHostInterface.update_host_params "Link to this definition")
update central server’s model params/weights with the aggregated params received from clients.
Parameters:
* **client\_params** (_Iterable__\[__ModelWeights__\]_) – the weights form different clients, ordered like \[params1, params2, …\]
* **aggregate\_weights** (_Iterable__\[__Union__\[__float__,_ _int__\]__\]_) – aggregate weights of different clients, usually set according to the clients’ training sample size. E.g., A, B, and C have 10, 20, and 30 images, then the aggregate\_weights can be \[1/6, 1/3, 1/2\] or \[10, 20, 30\].
Raises:
**NotImplementedError** – raised when called but not overriden.
_abstract_ host\_exit\_job(_host_)[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/strategy/index.html#FedEval.strategy.FedStrategyHostInterface.host_exit_job "Link to this definition")
do self-defined finishing jobs before the shutdown of the central server.
Parameters:
**host** – TODO(fgh)
Raises:
**NotImplementedError** – raised when called but not overriden.
_abstract_ host\_select\_train\_clients(_ready\_clients: List\[FedEval.config.ClientId\]_) → List\[FedEval.config.ClientId\][](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/strategy/index.html#FedEval.strategy.FedStrategyHostInterface.host_select_train_clients "Link to this definition")
select clients from the given ones for training purpose.
Parameters:
**ready\_clients** (_List__\[__ClientId__\]_) – the id list of clients that are ready for training.
Raises:
**NotImplementedError** – raised when called but not overriden.
Returns:
the id list of the selected clients.
Return type:
List\[ClientId\]
_abstract_ host\_select\_evaluate\_clients(_ready\_clients: List\[FedEval.config.ClientId\]_) → List\[FedEval.config.ClientId\][](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/strategy/index.html#FedEval.strategy.FedStrategyHostInterface.host_select_evaluate_clients "Link to this definition")
select clients from the given ones for evaluation purpose.
Parameters:
**ready\_clients** (_List__\[__ClientId__\]_) – the id list of clients that are ready for evaluaion.
Raises:
**NotImplementedError** – raised when called but not overriden.
Returns:
the id list of the selected clients.
Return type:
List\[ClientId\]
_class_ FedEval.strategy.FedStrategyInterface[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/strategy/index.html#FedEval.strategy.FedStrategyInterface "Link to this definition")
Bases: [`FedStrategyHostInterface`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/strategy/index.html#FedEval.strategy.FedStrategyHostInterface "FedEval.strategy.FedStrategyHostInterface")
, [`FedStrategyPeerInterface`](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/strategy/index.html#FedEval.strategy.FedStrategyPeerInterface "FedEval.strategy.FedStrategyPeerInterface")
the interface of federated strategies.
This class should be inherited instead of being instantiated.
Raises:
**NotImplementedError** – raised when called but not overriden.
_abstract property_ param\_parser_: [FedEval.utils.ParamParserInterface](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/utils/index.html#FedEval.utils.ParamParserInterface "FedEval.utils.ParamParserInterface")
_[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/strategy/index.html#FedEval.strategy.FedStrategyInterface.param_parser "Link to this definition")
the getter of param\_parser.
Raises:
**NotImplementedError** – raised when called but not overriden.
Returns:
self.\_param\_parser
Return type:
[ParamParserInterface](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/utils/index.html#FedEval.utils.ParamParserInterface "FedEval.utils.ParamParserInterface")
_abstract_ set\_logger(_logger_) → None[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/strategy/index.html#FedEval.strategy.FedStrategyInterface.set_logger "Link to this definition")
the setter of logger of this federated learning.
Parameters:
**logger** – an external logger.
Raises:
**NotImplementedError** – raised when called but not overriden.
_class_ FedEval.strategy.FedStrategyPeerInterface[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/strategy/index.html#FedEval.strategy.FedStrategyPeerInterface "Link to this definition")
_abstract property_ client\_id[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/strategy/index.html#FedEval.strategy.FedStrategyPeerInterface.client_id "Link to this definition")
Client ID
Type:
Returns
_abstract_ set\_host\_params\_to\_local(_host\_params: FedEval.aggregator.ModelWeights_, _current\_round: int_)[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/strategy/index.html#FedEval.strategy.FedStrategyPeerInterface.set_host_params_to_local "Link to this definition")
update the current local ML/DL model’s params with params received from the central server.
Parameters:
* **host\_params** (_ModelWeights_) – params received from the central server.
* **current\_round** (_int_) – the current round number
Raises:
**NotImplementedError** – raised when called but not overriden.
_abstract_ fit\_on\_local\_data()[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/strategy/index.html#FedEval.strategy.FedStrategyPeerInterface.fit_on_local_data "Link to this definition")
fit model with local data at client side.
Called by the selected clients.
Raises:
**NotImplementedError** – raised when called but not overriden.
Returns:
TODO(fgh)
_abstract_ retrieve\_local\_upload\_info() → FedEval.aggregator.ModelWeights[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/strategy/index.html#FedEval.strategy.FedStrategyPeerInterface.retrieve_local_upload_info "Link to this definition")
return the information aggregated from local model for uploading to the central server.
Called by the selected clients.
Raises:
**NotImplementedError** – raised when called but not overriden.
Returns:
the local model weights/params.
Return type:
ModelWeights
_abstract_ local\_evaluate() → Mapping\[str, int | float\][](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/strategy/index.html#FedEval.strategy.FedStrategyPeerInterface.local_evaluate "Link to this definition")
evaluate and test the model received from the central server.
Called by the selected clients.
Raises:
**NotImplementedError** – raised when called but not overriden.
Returns:
evaluation & test metrics.
Return type:
Mapping\[str, Union\[int, float\]\]
_abstract_ client\_exit\_job(_client_)[](https://fedeval.readthedocs.io/en/latest/autoapi/FedEval/strategy/index.html#FedEval.strategy.FedStrategyPeerInterface.client_exit_job "Link to this definition")
do self-defined finishing jobs before the shutdown of the local clients.
Parameters:
**client** – TODO(fgh)
Raises:
**NotImplementedError** – raised when called but not overriden.
---