(self, lr_weights, optimizer, n_iter_, batch_index, cipher_operator)
Compute hetero-lr loss for:
        loss = (1/N)*∑(log2 - 1/2*ywx + 1/8*(wx)^2), where y is label, w is model weight and x is features
        where (wx)^2 = (Wg * Xg + Wh * Xh)^2 = (Wg*Xg)^2 + (Wh*Xh)^2 + 2 * Wg*Xg * Wh*Xh

        Then loss = log2 - (1/N)*0.5*∑ywx + (1/N)*0.125*[∑(Wg*Xg)^2 + ∑(Wh*Xh)^2 + 2 * ∑(Wg*Xg * Wh*Xh)]

        where Wh*Xh is a table obtain from host and ∑(Wh*Xh)^2 is a sum number get from host.
Compute hetero-lr loss for:
        loss = (1/N)*∑(log2 - 1/2*ywx + 1/8*(wx)^2), where y is label, w is model weight and x is features
        where (wx)^2 = (Wg * Xg + Wh * Xh)^2 = (Wg*Xg)^2 + (Wh*Xh)^2 + 2 * Wg*Xg * Wh*Xh
Compute hetero - lr loss for : loss = ( 1 / N ) * ∑ ( log2 - 1 / 2 * ywx + 1 / 8 * ( wx ) ^2 ) where y is label w is model weight and x is features where ( wx ) ^2 = ( Wg * Xg + Wh * Xh ) ^2 = ( Wg * Xg ) ^2 + ( Wh * Xh ) ^2 + 2 * Wg * Xg * Wh * Xh
def compute_loss(self, lr_weights, optimizer, n_iter_, batch_index, cipher_operator):
        """
        Compute hetero-lr loss for:
        loss = (1/N)*∑(log2 - 1/2*ywx + 1/8*(wx)^2), where y is label, w is model weight and x is features
        where (wx)^2 = (Wg * Xg + Wh * Xh)^2 = (Wg*Xg)^2 + (Wh*Xh)^2 + 2 * Wg*Xg * Wh*Xh

        Then loss = log2 - (1/N)*0.5*∑ywx + (1/N)*0.125*[∑(Wg*Xg)^2 + ∑(Wh*Xh)^2 + 2 * ∑(Wg*Xg * Wh*Xh)]

        where Wh*Xh is a table obtain from host and ∑(Wh*Xh)^2 is a sum number get from host.
        """
        current_suffix = (n_iter_, batch_index)
        self_wx_square = self.forwards.mapValues(lambda x: np.square(4 * 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(lr_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 , lr_weights , optimizer , n_iter_ , batch_index , cipher_operator ) : current_suffix = ( n_iter_ , batch_index ) self_wx_square = self . forwards . mapValues ( lambda x : np . square ( 4 * 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 ( lr_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 )