Example #1
0
 def __init__(self, bin_method=consts.QUANTILE):
     self.aggregator = secure_mean_aggregator.Client(
         enable_secure_aggregate=True)
     self.suffix = tuple()
     self.bin_method = bin_method
     self.bin_obj: QuantileBinning = None
     self.bin_param = None
     self.abnormal_list = None
Example #2
0
def client_init_model(self, param):
    self.aggregate_iteration_num = 0
    self.aggregator = secure_mean_aggregator.Client(
        self.transfer_variable.secure_aggregator_trans_var)
    self.loss_scatter = loss_scatter.Client(
        self.transfer_variable.loss_scatter_trans_var)
    self.has_converged = has_converged.Client(
        self.transfer_variable.has_converged_trans_var)
    client_set_params(self, param)
Example #3
0
    def __init__(self, trans_var):
        super().__init__(trans_var=trans_var)
        self.aggregator = secure_mean_aggregator.Client(
            self.transfer_variable.secure_aggregator_trans_var)
        self.loss_scatter = loss_scatter.Client(
            self.transfer_variable.loss_scatter_trans_var)
        self.has_converged = has_converged.Client(
            self.transfer_variable.has_converged_trans_var)

        self.nn_model = None
Example #4
0
    def __init__(self, trans_var):
        super().__init__(trans_var=trans_var)
        self.aggregator = secure_mean_aggregator.Client(self.transfer_variable.secure_aggregator_trans_var)
        self.loss_scatter = loss_scatter.Client(self.transfer_variable.loss_scatter_trans_var)
        self.has_converged = has_converged.Client(self.transfer_variable.has_converged_trans_var)

        self.nn_model = None
        self._summary = dict(loss_history=[], is_converged=False)
        self._header = []
        self._label_align_mapping = None
Example #5
0
def secure_aggregator_call(job_id, role, ind, *args):
    if role == consts.ARBITER:
        agg = secure_mean_aggregator.Server()
        model = agg.weighted_mean_model()
        agg.send_aggregated_model(model)
    else:
        agg = secure_mean_aggregator.Client()
        # disorder dit
        order = list(range(5))
        np.random.seed(random.SystemRandom().randint(1, 100))
        np.random.shuffle(order)
        raw = {k: np.random.rand(10, 10) for k in order}

        w = OrderDictWeights(copy.deepcopy(raw))
        d = random.random()
        agg.send_weighted_model(w, weight=d)
        aggregated = agg.get_aggregated_model()
        return aggregated, raw, d