-
Notifications
You must be signed in to change notification settings - Fork 64
Configuration
flsim uses configuration files to manage the parameters of a simulation. These files, typically named config.json
, are of JSON format and have specific keys for setting parameters.
Use the provided example config.json
for reference.
Configuration parameters are divided into the following nested sections within a config.json
file:
-
clients
: nested options pertaining to the clients.-
total
:[positive integer]
, number of total clients to be managed by server. -
per_round
:[positive integer]
, number of clients participating in each round. -
label_distribution
:["uniform", "normal"]
, type of data distribution among clients.- In
"uniform"
, data partitions are uniformly distributed among clients. All labels occur roughly evenly between clients. - In
"normal"
, data partitions are modelled by Normal distribution. Some labels occur more often than others between clients.
- In
-
-
data
: nested options for how data is managed-
loading
:["static", "dynamic"]
, type of data loading scheme.- In
"static"
loading, data partitions are distributed to clients once, at the beginning of the simulation. This models multiple rounds of federated learning occurring in a short span, when new data hasn't been generated. - In
"dynamic"
loading, new data partitions are distributed to clients each round. This models federated learning occurring over a longer period, where clients generate new data.
- In
-
partition
: nested options for each data partition-
size
:[positive integer]
, size of each partition. OR, -
range
:[lower bound, upper bound]
, range for size of each partition to be randomly selected from. -
IID
:[boolean]
, whether data partitions should be IID. -
bias
: nested options for "bias" non-IID scheme. Cannot be used with "shard".- In the "bias" scheme, each client is assigned a bias towards a label (according to distribution specified above), and is a controlled portion of their data is that of their primary bias. The remainder of their data is either evenly of other labels, or completely of another random secondary bias.
-
primary
:[float between 0 and 1]
, ratio of how strong the primary bias is. For0.5
, half of the client's data samples will be of its primary bias. -
secondary
:[boolean]
, whether a secondary bias should be selected for remainder of each partition.
-
-
shard
: nested options for "shard" non-IID scheme. Cannot be used with "bias".- In the "shard" scheme, data is sorted into groups, called "shards", all containing roughly the same label. These shards have their partition sizes determined by the total number clients, and the relative size of the dataset. Each client is given 2 shards as its data partition.
-
-
federated learning
: specifications of federated learning task.-
rounds
:[positive integer]
, number of rounds of federated learning to simulate. AND/OR, -
target_accuracy
:[float between 0 and 1]
, target accuracy for training model. -
task
:["train"]
, federated learning task to perform. Currently only "train" is supported. -
epochs
:[positive integer]
, number of epochs each client performs each round. -
batch_size
:[10]
, size of data batch for each gradient update on a client.
-
-
model
:[string]
, name of directory of the model to be used."MNIST"
uses the model in./models/MNIST
. -
paths
: nested options for paths used by the framework.-
data
:[string]
, path to root data directory. Defaults to./data
. -
model
:[string]
, path to root model directory. Defaults to./models
. -
reports
:[string]
, path to file where reports will be saved.- The "reports" option allows the model weights from each client, from each round to be saved as a binary in the
*.pkl
format.
- The "reports" option allows the model weights from each client, from each round to be saved as a binary in the
-
-
server
:[string]
, name of server type (within./servers
) to use.