(self, data_instances, encrypted_calculator, model_weights, optimizer,
                                   n_iter_, batch_index, offset=None)
return optimized_gradient
Linear model gradient procedure
          Step 1: get host forwards which differ from different algorithm
                  For Logistic Regression and Linear Regression: forwards = wx
                  For Poisson Regression, forwards = exp(wx)

          Step 2: Compute self forwards and aggregate host forwards and get d = fore_gradient

          Step 3: Compute unilateral gradient = ∑d*x,

          Step 4: Send unilateral gradients to arbiter and received the optimized and decrypted gradient.
Linear model gradient procedure
          Step 1: get host forwards which differ from different algorithm
                  For Logistic Regression and Linear Regression: forwards = wx
                  For Poisson Regression, forwards = exp(wx)
Linear model gradient procedure Step 1 : get host forwards which differ from different algorithm For Logistic Regression and Linear Regression : forwards = wx For Poisson Regression forwards = exp ( wx )
def compute_gradient_procedure(self, data_instances, encrypted_calculator, model_weights, optimizer,
                                   n_iter_, batch_index, offset=None):
        """
          Linear model gradient procedure
          Step 1: get host forwards which differ from different algorithm
                  For Logistic Regression and Linear Regression: forwards = wx
                  For Poisson Regression, forwards = exp(wx)

          Step 2: Compute self forwards and aggregate host forwards and get d = fore_gradient

          Step 3: Compute unilateral gradient = ∑d*x,

          Step 4: Send unilateral gradients to arbiter and received the optimized and decrypted gradient.
          """
        current_suffix = (n_iter_, batch_index)
        # self.host_forwards = self.get_host_forward(suffix=current_suffix)

        # Compute Guest's partial d
        self.compute_half_d(data_instances, model_weights, encrypted_calculator,
                            batch_index, current_suffix)
        if self.use_async:
            unilateral_gradient = self._asynchronous_compute_gradient(data_instances, model_weights,
                                                                      cipher=encrypted_calculator[batch_index],
                                                                      current_suffix=current_suffix)
        else:
            unilateral_gradient = self._centralized_compute_gradient(data_instances, model_weights,
                                                                     cipher=encrypted_calculator[batch_index],
                                                                     current_suffix=current_suffix)

        if optimizer is not None:
            unilateral_gradient = optimizer.add_regular_to_grad(unilateral_gradient, model_weights)

        optimized_gradient = self.update_gradient(unilateral_gradient, suffix=current_suffix)
        # LOGGER.debug(f"Before return, optimized_gradient: {optimized_gradient}")
        return optimized_gradient
def compute_gradient_procedure ( self , data_instances , encrypted_calculator , model_weights , optimizer , n_iter_ , batch_index , offset = None ) : current_suffix = ( n_iter_ , batch_index ) # self.host_forwards = self.get_host_forward(suffix=current_suffix) # Compute Guest's partial d self . compute_half_d ( data_instances , model_weights , encrypted_calculator , batch_index , current_suffix ) if self . use_async : unilateral_gradient = self . _asynchronous_compute_gradient ( data_instances , model_weights , cipher = encrypted_calculator [ batch_index ] , current_suffix = current_suffix ) else : unilateral_gradient = self . _centralized_compute_gradient ( data_instances , model_weights , cipher = encrypted_calculator [ batch_index ] , current_suffix = current_suffix ) if optimizer is not None : unilateral_gradient = optimizer . add_regular_to_grad ( unilateral_gradient , model_weights ) optimized_gradient = self . update_gradient ( unilateral_gradient , suffix = current_suffix ) # LOGGER.debug(f"Before return, optimized_gradient: {optimized_gradient}") return optimized_gradient