server.py
def aggregate_models(models, weights):
    """aggregate models based on weights
    params:
        models: model updates from clients
        weights: weights for each model, e.g. by data sizes or cosine distance of features
    """
    if models == []:
        return None
    model = add_model(None, models[0], 0, weights[0])
    total_no_data = weights[0]
    for i in range(1, len(models)):
        model = add_model(model, models[i], total_no_data, weights[i])
        model = scale_model(model, 1.0 / (total_no_data+weights[i]))
        total_no_data = total_no_data + weights[i]
    return model
aggregate models based on weights
    params:
        models: model updates from clients
        weights: weights for each model, e.g. by data sizes or cosine distance of features
    
aggregate models based on weights
params:
models: model updates from clients
weights: weights for each model, e.g. by data sizes or cosine distance of features
aggregate models based on weights params : models : model updates from clients weights : weights for each model e . g . by data sizes or cosine distance of features
def aggregate_models(models, weights):
    if models == []:
        return None
    model = add_model(None, models[0], 0, weights[0])
    total_no_data = weights[0]
    for i in range(1, len(models)):
        model = add_model(model, models[i], total_no_data, weights[i])
        model = scale_model(model, 1.0 / (total_no_data+weights[i]))
        total_no_data = total_no_data + weights[i]
    return model
def aggregate_models ( models , weights ) : if models == [ ] : return None model = add_model ( None , models [ 0 ] , 0 , weights [ 0 ] ) total_no_data = weights [ 0 ] for i in range ( 1 , len ( models ) ) : model = add_model ( model , models [ i ] , total_no_data , weights [ i ] ) model = scale_model ( model , 1.0 / ( total_no_data + weights [ i ] ) ) total_no_data = total_no_data + weights [ i ] return model
aggregate models based on weights
params:
models: model updates from clients
weights: weights for each model, e.g.
aggregate models based on weights params : models : model updates from clients weights : weights for each model e . g .
"""aggregate models based on weights
    params:
        models: model updates from clients
        weights: weights for each model, e.g. by data sizes or cosine distance of features
    """
models
weights