qfedavg_server
qFedavgServer(num_clients, total_epoch, q=1, learning_rate=0.1)
¶
Bases: strategy_server.StrategyServer
Implement the strategy of qFedavg on server side.
Attributes:
Name | Type | Description |
---|---|---|
num_clients |
int
|
client number |
total_epoch |
int
|
the epoch number of client trainning |
q |
float
|
q factor. Defaults to 1. |
learning_rate |
float
|
learning rate. Defaults to 0.1. |
_fs |
dict
|
loss values of each client |
Source code in iflearner/business/homo/strategy/qfedavg_server.py
norm_grad(grad)
¶
normalize the grad.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
grad |
Dict[str, Dict]
|
grad |
required |
Returns:
Name | Type | Description |
---|---|---|
_type_ | the normalized grad |
Source code in iflearner/business/homo/strategy/qfedavg_server.py
step(deltas, hs)
¶
a optimized step for deltas.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
deltas |
Dict[str, Dict]
|
the delta of model parameters |
required |
hs |
Dict[str, float]
|
demominator |
required |
Returns:
Name | Type | Description |
---|---|---|
_type_ | new parameters after optimizing the deltas |