(self, model_weights, optimizer, n_iter_, batch_index, cipher_operator)
Compute htero linr loss for:
            loss = (1/2N)*\sum(wx-y)^2 where y is label, w is model weight and x is features

            Note: (wx - y)^2 = (wx_h)^2 + (wx_g - y)^2 + 2*(wx_h + (wx_g - y))
Compute htero linr loss for:
            loss = (1/2N)*\sum(wx-y)^2 where y is label, w is model weight and x is features
Compute htero linr loss for : loss = ( 1 / 2N ) * \ sum ( wx - y ) ^2 where y is label w is model weight and x is features
def compute_loss(self, model_weights, optimizer, n_iter_, batch_index, cipher_operator):
        '''
        Compute htero linr loss for:
            loss = (1/2N)*\sum(wx-y)^2 where y is label, w is model weight and x is features

            Note: (wx - y)^2 = (wx_h)^2 + (wx_g - y)^2 + 2*(wx_h + (wx_g - y))
        '''

        current_suffix = (n_iter_, batch_index)
        self_wx_square = self.forwards.mapValues(lambda x: np.square(x)).reduce(reduce_add)
        en_wx_square = cipher_operator.encrypt(self_wx_square)
        self.remote_loss_intermediate(en_wx_square, suffix=current_suffix)

        loss_regular = optimizer.loss_norm(model_weights)
        if loss_regular is not None:
            en_loss_regular = cipher_operator.encrypt(loss_regular)
            self.remote_loss_regular(en_loss_regular, suffix=current_suffix)
def compute_loss ( self , model_weights , optimizer , n_iter_ , batch_index , cipher_operator ) : current_suffix = ( n_iter_ , batch_index ) self_wx_square = self . forwards . mapValues ( lambda x : np . square ( x ) ) . reduce ( reduce_add ) en_wx_square = cipher_operator . encrypt ( self_wx_square ) self . remote_loss_intermediate ( en_wx_square , suffix = current_suffix ) loss_regular = optimizer . loss_norm ( model_weights ) if loss_regular is not None : en_loss_regular = cipher_operator . encrypt ( loss_regular ) self . remote_loss_regular ( en_loss_regular , suffix = current_suffix )