5.1.1.3.1.1. FedEval.config.configuration

5.1.1.3.1.1.1. Module Contents

5.1.1.3.1.1.1.1. Classes

_Configuraiton

_DataConfig

_ModelConfig

_RT_Machine

_RuntimeConfig

ConfigurationManagerInterface

Helper class that provides a standard way to create an ABC using

ClientConfigurationManagerInterface

an interface of ConfigurationManager from the client side,

ServerConfigurationManagerInterface

an interface of ConfigurationManager from the central server side,

_CfgYamlInterface

an interface that regulates the methods used to serialize

_CfgJsonInterface

an interface that regulates the methods used to serialize

_CfgSerializer

types of serializer for configurations.

_CfgFileInterface

an interface that regulates the methods used to serialize

_RoledConfigurationInterface

Helper class that provides a standard way to create an ABC using

ConfigurationManager

the base class of singletons.

5.1.1.3.1.1.1.2. Attributes

RawConfigurationDict

DEFAULT_D_CFG_FILENAME_YAML

DEFAULT_MDL_CFG_FILENAME_YAML

DEFAULT_RT_CFG_FILENAME_YAML

DEFAULT_D_CFG_FILENAME_JSON

DEFAULT_MDL_CFG_FILENAME_JSON

DEFAULT_RT_CFG_FILENAME_JSON

_D_DIR_KEY

_D_NAME_KEY

_D_NI_ENABLE_KEY

_D_NI_CLASS_KEY

_D_NI_STRATEGY_KEY

_D_NORMALIZE_KEY

_D_SAMPLE_SIZE_KEY

_D_PARTITION_KEY

_D_FEATURE_SIZE

_D_RANDOM_SEED

_DEFAULT_D_CFG

_STRATEGY_KEY

_STRATEGY_NAME_KEY

_STRATEGY_ETA_KEY

_STRATEGY_B_KEY

_STRATEGY_C_KEY

_STRATEGY_E_KEY

_STRATEGY_E_RATIO

_STRATEGY_E_DISTRIBUTE

_STRATEGY_MAX_ROUND_NUM_KEY

_STRATEGY_TOLERANCE_NUM_KEY

_STRATEGY_NUM_ROUNDS_BETWEEN_VAL_KEY

_STRATEGY_FEDSTC_SPARSITY_KEY

_STRATEGY_FEDPROX_MU_KEY

_STRATEGY_FEDOPT_TAU_KEY

_STRATEGY_FEDOPT_BETA1_KEY

_STRATEGY_FEDOPT_BETA2_KEY

_STRATEGY_FEDOPT_NAME_KEY

_STRATEGY_FETCHSGD_COL_NUM_KEY

_STRATEGY_FETCHSGD_ROW_NUM_KEY

_STRATEGY_FETCHSGD_BLOCK_NUM_KEY

_STRATEGY_FETCHSGD_TOP_K_KEY

_STRATEGY_FEDSVD_BLOCK

_STRATEGY_FEDSVD_MODE

_STRATEGY_FEDSVD_TOPK

_STRATEGY_FEDSVD_L2

_STRATEGY_FEDSVD_OPT_1

_STRATEGY_FEDSVD_OPT_2

_STRATEGY_FEDSVD_EVALUATE

_ML_KEY

_ML_NAME_KEY

_ML_ACTIVATION_KEY

_ML_DROPOUT_RATIO_KEY

_ML_UNITS_SIZE_KEY

_ML_OPTIMIZER_KEY

_ML_OPTIMIZER_NAME_KEY

_ML_OPTIMIZER_LEARNING_RATE_KEY

_ML_OPTIMIZER_MOMENTUM_KEY

_ML_LOSS_CALC_METHODS_KEY

_ML_METRICS_KEY

_ML_DEFAULT_METRICS

_DEFAULT_MDL_CFG

_RT_SERVER_KEY

_RT_S_HOST_KEY

_RT_S_LISTEN_KEY

_RT_S_PORT_KEY

_RT_S_CLIENTS_NUM_KEY

_RT_S_SECRET_KEY

_RT_DOCKER_KEY

_RT_D_IMAGE_LABEL_KEY

_RT_D_CONTAINER_NUM_KEY

_RT_D_GPU_ENABLE_KEY

_RT_D_GPU_NUM_KEY

_RT_MACHINES_KEY

_RT_M_ADDRESS_KEY

_RT_M_PORT_KEY

_RT_M_USERNAME_KEY

_RT_M_WORK_DIR_KEY

_RT_M_SK_FILENAME_KEY

_RT_M_CAPACITY_KEY

_RT_M_SERVER_NAME

_RT_LOG_KEY

_RT_L_BASE_LEVEL_KEY

_RT_L_FILE_LEVEL_KEY

_RT_L_CONSOLE_LEVEL_KEY

_RT_L_DIR_PATH_KEY

_RT_COMMUNICATION_KEY

_RT_COMM_METHOD_KEY

_RT_COMM_PORT_KEY

_RT_COMM_LIMIT_FLAG_KEY

_RT_COMM_BANDWIDTH_UP_KEY

_RT_COMM_BANDWIDTH_DOWN_KEY

_RT_COMM_LATENCY_KEY

_RT_COMM_FAST_MODE

_DEFAULT_RT_CFG

_DEFAULT_ENCODING

_Stream

FedEval.config.configuration.RawConfigurationDict
FedEval.config.configuration.DEFAULT_D_CFG_FILENAME_YAML = '1_data_config.yml'
FedEval.config.configuration.DEFAULT_MDL_CFG_FILENAME_YAML = '2_model_config.yml'
FedEval.config.configuration.DEFAULT_RT_CFG_FILENAME_YAML = '3_runtime_config.yml'
FedEval.config.configuration.DEFAULT_D_CFG_FILENAME_JSON = '1_data_config.yml'
FedEval.config.configuration.DEFAULT_MDL_CFG_FILENAME_JSON = '2_model_config.yml'
FedEval.config.configuration.DEFAULT_RT_CFG_FILENAME_JSON = '3_runtime_config.yml'
FedEval.config.configuration._D_DIR_KEY = 'data_dir'
FedEval.config.configuration._D_NAME_KEY = 'dataset'
FedEval.config.configuration._D_NI_ENABLE_KEY = 'non-iid'
FedEval.config.configuration._D_NI_CLASS_KEY = 'non-iid-class'
FedEval.config.configuration._D_NI_STRATEGY_KEY = 'non-iid-strategy'
FedEval.config.configuration._D_NORMALIZE_KEY = 'normalize'
FedEval.config.configuration._D_SAMPLE_SIZE_KEY = 'sample_size'
FedEval.config.configuration._D_PARTITION_KEY = 'train_val_test'
FedEval.config.configuration._D_FEATURE_SIZE = 'feature_size'
FedEval.config.configuration._D_RANDOM_SEED = 'random_seed'
FedEval.config.configuration._DEFAULT_D_CFG: RawConfigurationDict
FedEval.config.configuration._STRATEGY_KEY = 'FedModel'
FedEval.config.configuration._STRATEGY_NAME_KEY = 'name'
FedEval.config.configuration._STRATEGY_ETA_KEY = 'eta'
FedEval.config.configuration._STRATEGY_B_KEY = 'B'
FedEval.config.configuration._STRATEGY_C_KEY = 'C'
FedEval.config.configuration._STRATEGY_E_KEY = 'E'
FedEval.config.configuration._STRATEGY_E_RATIO = 'evaluate_ratio'
FedEval.config.configuration._STRATEGY_E_DISTRIBUTE = 'distributed_evaluate'
FedEval.config.configuration._STRATEGY_MAX_ROUND_NUM_KEY = 'max_rounds'
FedEval.config.configuration._STRATEGY_TOLERANCE_NUM_KEY = 'num_tolerance'
FedEval.config.configuration._STRATEGY_NUM_ROUNDS_BETWEEN_VAL_KEY = 'rounds_between_val'
FedEval.config.configuration._STRATEGY_FEDSTC_SPARSITY_KEY = 'sparsity'
FedEval.config.configuration._STRATEGY_FEDPROX_MU_KEY = 'mu'
FedEval.config.configuration._STRATEGY_FEDOPT_TAU_KEY = 'tau'
FedEval.config.configuration._STRATEGY_FEDOPT_BETA1_KEY = 'beta1'
FedEval.config.configuration._STRATEGY_FEDOPT_BETA2_KEY = 'beta2'
FedEval.config.configuration._STRATEGY_FEDOPT_NAME_KEY = 'opt_name'
FedEval.config.configuration._STRATEGY_FETCHSGD_COL_NUM_KEY = 'num_col'
FedEval.config.configuration._STRATEGY_FETCHSGD_ROW_NUM_KEY = 'num_row'
FedEval.config.configuration._STRATEGY_FETCHSGD_BLOCK_NUM_KEY = 'num_block'
FedEval.config.configuration._STRATEGY_FETCHSGD_TOP_K_KEY = 'top_k'
FedEval.config.configuration._STRATEGY_FEDSVD_BLOCK = 'block_size'
FedEval.config.configuration._STRATEGY_FEDSVD_MODE = 'fedsvd_mode'
FedEval.config.configuration._STRATEGY_FEDSVD_TOPK = 'fedsvd_top_k'
FedEval.config.configuration._STRATEGY_FEDSVD_L2 = 'fedsvd_lr_l2'
FedEval.config.configuration._STRATEGY_FEDSVD_OPT_1 = 'fedsvd_opt_1'
FedEval.config.configuration._STRATEGY_FEDSVD_OPT_2 = 'fedsvd_opt_2'
FedEval.config.configuration._STRATEGY_FEDSVD_EVALUATE = 'fedsvd_debug_evaluate'
FedEval.config.configuration._ML_KEY = 'MLModel'
FedEval.config.configuration._ML_NAME_KEY = 'name'
FedEval.config.configuration._ML_ACTIVATION_KEY = 'activation'
FedEval.config.configuration._ML_DROPOUT_RATIO_KEY = 'dropout'
FedEval.config.configuration._ML_UNITS_SIZE_KEY = 'units'
FedEval.config.configuration._ML_OPTIMIZER_KEY = 'optimizer'
FedEval.config.configuration._ML_OPTIMIZER_NAME_KEY = 'name'
FedEval.config.configuration._ML_OPTIMIZER_LEARNING_RATE_KEY = 'lr'
FedEval.config.configuration._ML_OPTIMIZER_MOMENTUM_KEY = 'momentum'
FedEval.config.configuration._ML_LOSS_CALC_METHODS_KEY = 'loss'
FedEval.config.configuration._ML_METRICS_KEY = 'metrics'
FedEval.config.configuration._ML_DEFAULT_METRICS = ['accuracy']
FedEval.config.configuration._DEFAULT_MDL_CFG: RawConfigurationDict
FedEval.config.configuration._RT_SERVER_KEY = 'server'
FedEval.config.configuration._RT_S_HOST_KEY = 'host'
FedEval.config.configuration._RT_S_LISTEN_KEY = 'listen'
FedEval.config.configuration._RT_S_PORT_KEY = 'port'
FedEval.config.configuration._RT_S_CLIENTS_NUM_KEY = 'num_clients'
FedEval.config.configuration._RT_S_SECRET_KEY = 'secret_key'
FedEval.config.configuration._RT_DOCKER_KEY = 'docker'
FedEval.config.configuration._RT_D_IMAGE_LABEL_KEY = 'image'
FedEval.config.configuration._RT_D_CONTAINER_NUM_KEY = 'num_containers'
FedEval.config.configuration._RT_D_GPU_ENABLE_KEY = 'enable_gpu'
FedEval.config.configuration._RT_D_GPU_NUM_KEY = 'num_gpu'
FedEval.config.configuration._RT_MACHINES_KEY = 'machines'
FedEval.config.configuration._RT_M_ADDRESS_KEY = 'host'
FedEval.config.configuration._RT_M_PORT_KEY = 'port'
FedEval.config.configuration._RT_M_USERNAME_KEY = 'username'
FedEval.config.configuration._RT_M_WORK_DIR_KEY = 'dir'
FedEval.config.configuration._RT_M_SK_FILENAME_KEY = 'key'
FedEval.config.configuration._RT_M_CAPACITY_KEY = 'capacity'
FedEval.config.configuration._RT_M_SERVER_NAME = 'server'
FedEval.config.configuration._RT_LOG_KEY = 'log'
FedEval.config.configuration._RT_L_BASE_LEVEL_KEY = 'base_level'
FedEval.config.configuration._RT_L_FILE_LEVEL_KEY = 'file_log_level'
FedEval.config.configuration._RT_L_CONSOLE_LEVEL_KEY = 'console_log_level'
FedEval.config.configuration._RT_L_DIR_PATH_KEY = 'log_dir'
FedEval.config.configuration._RT_COMMUNICATION_KEY = 'communication'
FedEval.config.configuration._RT_COMM_METHOD_KEY = 'method'
FedEval.config.configuration._RT_COMM_PORT_KEY = 'port'
FedEval.config.configuration._RT_COMM_LIMIT_FLAG_KEY = 'limit_network_resource'
FedEval.config.configuration._RT_COMM_BANDWIDTH_UP_KEY = 'bandwidth_upload'
FedEval.config.configuration._RT_COMM_BANDWIDTH_DOWN_KEY = 'bandwidth_download'
FedEval.config.configuration._RT_COMM_LATENCY_KEY = 'latency'
FedEval.config.configuration._RT_COMM_FAST_MODE = 'fast_mode'
FedEval.config.configuration._DEFAULT_RT_CFG: RawConfigurationDict
class FedEval.config.configuration._Configuraiton(config: RawConfigurationDict)[source]

Bases: object

property inner: RawConfigurationDict

return a deep copy of its inner configuraiton data, presented as a dict. Noticed that modifications on the returned object will NOT affect the original configuration.

Returns:

a deep copy of the inner data representaiton of this config object.

Return type:

RawConfigurationDict

static _config_filter(config: RawConfigurationDict) RawConfigurationDict[source]
class FedEval.config.configuration._DataConfig(data_config: RawConfigurationDict = _DEFAULT_D_CFG)[source]

Bases: _Configuraiton

property dataset_name: str

the name of the dataset, chosen from mnist, cifar10, cifar100, femnist, and mnist.

Returns:

the name of chosen dataset.

Return type:

str

property iid: bool

if the dataset would be used in an i.i.d. manner.

Returns:

True if the dataset is sampled in an i.i.d. manner; otherwise, False.

Return type:

bool

property non_iid_class_num: int

return the number of classes hold by each client. Only avaliable when the dataset is sampled in a non-i.i.d. form.

Raises:

AttributeError – raised when called without non-i.i.d. setting.

Returns:

the number of classes hold by each client.

Return type:

int

property non_iid_strategy_name: str

return the name of non-i.i.d. data partition strategy. Two choices are given: 1. “natural” strategy for femnist and celebA dataset 2. “average” for mnist, cifar10 and cifar100

Raises:

AttributeError – raised when called without non-i.i.d. setting.

Returns:

the name of non-i.i.d. data partition strategy.

Return type:

str

property normalized: bool

whether the image pixel data point will be normalized to [0, 1].

Returns:

True if data points would be normalized; otherwise, False.

Return type:

bool

property sample_size: int

return the number of samples owned by each client.

property data_partition: Sequence[float]

get the data partition proportion, ordered as [train data ratio, test data ration, validation data ration].

Constraints met by the return value:
  1. all the ratios in the returned list sum up to 1.

  2. all the ratios in the returned list are non-negative.

Returns:

[train data ratio, test data ration, validation data ration]

Return type:

Sequence[float]

property feature_size
property random_seed
_IID_EXCEPTiON_CONTENT = 'The dataset is configured as iid.'
static _config_filter(config: RawConfigurationDict) RawConfigurationDict[source]
_non_iid_strategy_name_check() bool[source]

check if the non-i.i.d. data partition strategy is known.

Returns:

True if the data partition strategy name is registered as followed; otherwise, False.

Return type:

bool

class FedEval.config.configuration._ModelConfig(model_config: RawConfigurationDict = _DEFAULT_MDL_CFG)[source]

Bases: _Configuraiton

property strategy_config: RawConfigurationDict

return a copy of inner strategy raw dict.

Returns:

a deep copy of the strategy-related configuration dict.

Return type:

RawConfigurationDict

Type:

a variant of inner method

property ml_config: RawConfigurationDict

return a copy of inner machine learning raw dict.

Returns:

a deep copy of the ML model-related configuration dict.

Return type:

RawConfigurationDict

Type:

a variant of inner method

property strategy_name: str

get the class name of the federated strategy (i.e., the main controller of federated process). Notice that the strategy class with this name (case sensitive and whole word matching) should have been implemented in this library (specifically, in strategy module), otherwise a TypeNotFound exception would be raised in the following steps.

Returns:

the classname/typename of the federated strategy.

Return type:

str

property ml_method_name: str

get the class name of the machine learning model (i.e., the kernel of the whole calculation process). Notice that the strategy class with this name (case sensitive and whole word matching) should have been implemented in this library (specifically, in model module), otherwise a TypeNotFound exception would be raised in the following steps.

Returns:

the classname/typename of the inner machine learning model.

Return type:

str

property server_learning_rate: float

get the learning rate on the server side. Only available in FedOpt and FedSCA.

Raises:

AttributeError – called in a in proper federated strategy.

Returns:

the learning rate on the server side.

Return type:

float

property B: int

the local minibatch size used for the updates on the client side.

property C: float

the fraction of clients that perform computation in each round.

Examples

if there are 100 available clients in a test network with a C of 0.2, then there should be (100*0.2=)20 clients in each round of iterations.

property E: int

the number of training passes that each client makes over its local dataset in each round.

property evaluate_ratio
property distributed_evaluate
property max_round_num: int

the total/maximum number of the iteration rounds.

property tolerance_num: int

the patience for early stopping

property num_of_rounds_between_val: int

the number of rounds between test or validation

property stc_sparsity: float

the origin of FedSTC

Type:

TODO(fgh)

property prox_mu: float

the /mu parameter in FedProx, a scaler that measures the approximation between the local model and the global model. More info available in Federated Optimization in Heterogeneous Networks(arXiv:1812.06127).

property opt_tau: float
property opt_beta_1: float
property opt_beta_2: float
property activation: str

the name of activation mechanism in tensorflow layers. More info available in https://tensorflow.google.cn/api_docs/python/tf/keras/activations.

property dropout: float

the dropout fraction of Dropout layer in the DL model.

property unit_size: Sequence[int]

the size of sequential neural network components.

Returns:

the size of network components (ordered the same with data flow direction)

Return type:

Sequence[int]

property optimizer_name: str

the name of the optimizer in tensorflow network. More info available in https://tensorflow.google.cn/api_docs/python/tf/keras/optimizers.

property learning_rate: float

the learning rate of model training in tensorlflow.

property momentum: float

the momentum of the optimizer.

property loss_calc_method: str

the identifier of a loss function in tensorflow. More info available in https://tensorflow.google.cn/api_docs/python/tf/keras/losses.

Returns:

the string name of the loss function during model training.

Return type:

str

property metrics: Sequence[str]

names of the metrics used in model training and validation in tensorflow. More info in https://tensorflow.google.cn/api_docs/python/tf/keras/metrics.

Returns:

a copy of metric names.

Return type:

Sequence[str]

property col_num: int

the number of columns in FetchSGD. More info available at https://export.arxiv.org/abs/2007.07682.

property row_num: int

the number of rows in FetchSGD. More info available at https://export.arxiv.org/abs/2007.07682.

property block_num: int

the number of blocks in FetchSGD. More info available at https://export.arxiv.org/abs/2007.07682.

property top_k: int

the number of top items in FetchSGD. More info available at https://export.arxiv.org/abs/2007.07682.

property block_size: int

block size of FedSVD

property svd_mode: str

block size of FedSVD

property svd_top_k: int

block size of FedSVD

property svd_lr_l2

L2 penalize of FedSVD

property svd_opt_1
property svd_opt_2
property svd_evaluate
static _config_filter(config: RawConfigurationDict) RawConfigurationDict[source]
static __check_raw_config(config: RawConfigurationDict) None
static __check_runtime_config_shallow_structure(config: RawConfigurationDict) None
static __check_ML_model_params(ml_config: RawConfigurationDict) None
class FedEval.config.configuration._RT_Machine(machine_config: RawConfigurationDict, is_server: bool = False)[source]

Bases: _Configuraiton

property is_server: bool

if the machine is a central server.

property addr: str

the IP address of this machine or the name of this container in docker.

property port: int

the port of this virtual machine on the physical machine.

property username: str

the username of this machine.

property work_dir_path: str

the path of this machine’s working diretory.

property key_filename: str

the name of ssh connection secret key file.

property capacity: int

the number of container that this machine can handle. Only available on the client side.

Raises:

AttributeError – called from the server side.

__ITEM_CHECK_VALUE_ERROR_PATTERN = 'machine configuraitons should have {}.'
static __check_items(config: RawConfigurationDict, is_server: bool = False) None
class FedEval.config.configuration._RuntimeConfig(runtime_config: RawConfigurationDict = _DEFAULT_RT_CFG)[source]

Bases: _Configuraiton

property machines: Mapping[str, _RT_Machine] | None

return a deep copy of all the machines in the configuration.

Returns:

None if there is no machine setting.

Return type:

Optional[Mapping[str, _RT_Machine]]

property client_machines: Mapping[str, _RT_Machine] | None

return a deep copy of all the client machines in the configuration.

Returns:

None if there is no client machine setting.

Return type:

Optional[Mapping[str, _RT_Machine]]

property server_machine
property limit_network_resource: bool

whether limit the network resource

property bandwidth_upload: str

the bandwidth of each container.

property bandwidth_download: str

the bandwidth of each container.

property latency: str

the latency of each container.

property image_label: str

the label of the docker image used in this experiment.

property container_num: int

the number of total docker containers in this experiment.

property central_server_addr: str

the IP address of the central server.

property central_server_listen_at: str

the listening IP address of the flask services on the cetral server side.

property central_server_port: int

the port that the central server occupies.

property client_num: int

the total number of the clients.

property base_log_level: str

the base logging level of all the loggers.

property file_log_level: str

the logging level in the log files.

property console_log_level: str

the logging level in consoles.

property secret_key: str

the secret key of the flask service on the central server side.

Returns:

the secret key as a string.

Return type:

str

property gpu_enabled: bool

whether the GPU is enabled in this experiment.

property gpu_num: int

the number of GPUs.

Raises:

AttributeError – called without GPUs enabled.

property comm_method: str

the method/technique used for mechaine-wise communication in the experiment.

property comm_port: int

the port for communication on the server side.

property comm_fast_mode: bool
In fast mode, all the clients in one container will only download the parameters once

to improve the efficiency, e.g., when tuning the parameters.

Turn off the fast_mode if you are benchmarking the communication and time

__ITEM_CHECK_VALUE_ERROR_PATTERN = 'runtime configurations should have {}.'
__AVAILABLE_LOGGING_LEVELS
static _config_filter(config: RawConfigurationDict) RawConfigurationDict[source]
static __check_items(config: RawConfigurationDict) None
_has_machines() bool[source]
__init_machines() bool
static _check_log_level_validity(level: str) None[source]

make sure the given string is one of the logging levels.

Parameters:

level (str) – a string representation of a logging level.

Raises:

ValueError – the given string is not a valid logging level.

class FedEval.config.configuration.ConfigurationManagerInterface[source]

Bases: abc.ABC

Helper class that provides a standard way to create an ABC using inheritance.

abstract property data_config_filename: str
abstract property model_config_filename: str
abstract property runtime_config_filename: str
abstract property data_config: RawConfigurationDict
abstract property model_config: _ModelConfig
abstract property runtime_config: RawConfigurationDict
abstract property job_id
class FedEval.config.configuration.ClientConfigurationManagerInterface[source]

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.configuration.ServerConfigurationManagerInterface[source]

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
FedEval.config.configuration._DEFAULT_ENCODING = 'utf-8'
FedEval.config.configuration._Stream
class FedEval.config.configuration._CfgYamlInterface[source]

Bases: abc.ABC

an interface that regulates the methods used to serialize and deserialize configuraitons in YAML.

static load_configs(src_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) Tuple[RawConfigurationDict, RawConfigurationDict, RawConfigurationDict][source]
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) None[source]
class FedEval.config.configuration._CfgJsonInterface[source]

Bases: abc.ABC

an interface that regulates the methods used to serialize and deserialize configuraitons in JSON.

static load_configs(src_path, data_config_filename: str = DEFAULT_D_CFG_FILENAME_JSON, model_config_filename: str = DEFAULT_MDL_CFG_FILENAME_JSON, runtime_config_filename: str = DEFAULT_RT_CFG_FILENAME_JSON, encoding=_DEFAULT_ENCODING) Tuple[RawConfigurationDict, RawConfigurationDict, RawConfigurationDict][source]
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) None[source]
class FedEval.config.configuration._CfgSerializer[source]

Bases: enum.Enum

types of serializer for configurations.

YAML = 'yaml'
JSON = 'json'
class FedEval.config.configuration._CfgFileInterface[source]

Bases: abc.ABC

an interface that regulates the methods used to serialize and deserialize configuraitons from the file system.

abstract static from_files(from_config_path: str, serializer: str | _CfgSerializer = _CfgSerializer.YAML, encoding=_DEFAULT_ENCODING) ConfigurationManagerInterface[source]
abstract to_files(dst_dir_path: str, serializer: str | _CfgSerializer = _CfgSerializer.YAML, encoding: str | None = None) None[source]
static serializer2enum(serializer: str | _CfgSerializer) _CfgSerializer[source]

convert serializer name(string) into enum type

class FedEval.config.configuration._RoledConfigurationInterface[source]

Bases: abc.ABC

Helper class that provides a standard way to create an ABC using inheritance.

abstract property role: FedEval.config.role.Role
class FedEval.config.configuration.ConfigurationManager(data_config: RawConfigurationDict = _DEFAULT_D_CFG, model_config: RawConfigurationDict = _DEFAULT_MDL_CFG, runtime_config: RawConfigurationDict = _DEFAULT_RT_CFG, thread_safe: bool = False)[source]

Bases: 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
property config_unique_id
property data_dir_name: str

The output directory of the clients’ data.

Returns:

the name of the data directory.

Return type:

str

property log_dir_path: str

the path of the base of log directory.

property history_record_path: str

the path of the history record.

property job_id: str
property encoding: str

the encoding scheme during (de)serialization.

property data_config_filename: str
property model_config_filename: str
property runtime_config_filename: str
property data_config: _DataConfig
property model_config: _ModelConfig
property runtime_config: _RuntimeConfig
property num_of_train_clients_contacted_per_round: int

the number of clients selected to participate the main federated process in each round.

property num_of_eval_clients_contacted_per_round: int

the number of clients selected to participate the main federated process in each round.

property role: FedEval.config.role.Role

return the role of this runtime entity.

Raises:

AttributeError – called without role configured.

Returns:

the role of this runtime entity.

Return type:

Role

__init_once_lock
__initiated = False
_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]
classmethod generate_unique_id(data_config: dict, model_config: dict, runtime_config: dict)[source]
static _get_md5(config_string)[source]
static load_configs(src_path, serializer: str | _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]
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 = _CfgSerializer.YAML)[source]
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 = _CfgSerializer.YAML, encoding=_DEFAULT_ENCODING)[source]
to_files(dst_dir_path: str, serializer: str | _CfgSerializer = _CfgSerializer.YAML, encoding: str | None = None) None[source]
__init_role() None