(self, data_loader: FTLDataLoader)
return phi, phi_product, overlap_ua, [y_overlap_2_phi_2, y_overlap_phi, mapping_comp_a]
compute guest components
compute guest components
compute guest components
def batch_compute_components(self, data_loader: FTLDataLoader):

        """
        compute guest components
        """

        phi, overlap_ua = self.compute_phi_and_overlap_ua(data_loader)  # Φ_A [1, feature_dim]

        phi_product = np.matmul(phi.transpose(), phi)  # (Φ_A)‘(Φ_A) [feature_dim, feature_dim]

        if self.overlap_y is None:
            self.overlap_y = data_loader.get_overlap_y()  # {C(y)=y} [1, feat_dim]
        if self.overlap_y_2 is None:
            self.overlap_y_2 = self.overlap_y * self.overlap_y  # {D(y)=y^2} # [1, feat_dim]

        overlap_ua = np.concatenate(overlap_ua, axis=0)  # [overlap_num, feat_dim]

        # 3 components will be sent to host
        y_overlap_2_phi_2 = 0.25 * np.expand_dims(self.overlap_y_2, axis=2) * phi_product
        y_overlap_phi = -0.5 * self.overlap_y * phi
        mapping_comp_a = -overlap_ua * self.constant_k

        return phi, phi_product, overlap_ua, [y_overlap_2_phi_2, y_overlap_phi, mapping_comp_a]
def batch_compute_components ( self , data_loader : FTLDataLoader ) : phi , overlap_ua = self . compute_phi_and_overlap_ua ( data_loader ) # Φ_A [1, feature_dim] phi_product = np . matmul ( phi . transpose ( ) , phi ) # (Φ_A)‘(Φ_A) [feature_dim, feature_dim] if self . overlap_y is None : self . overlap_y = data_loader . get_overlap_y ( ) # {C(y)=y} [1, feat_dim] if self . overlap_y_2 is None : self . overlap_y_2 = self . overlap_y * self . overlap_y # {D(y)=y^2} # [1, feat_dim] overlap_ua = np . concatenate ( overlap_ua , axis = 0 ) # [overlap_num, feat_dim] # 3 components will be sent to host y_overlap_2_phi_2 = 0.25 * np . expand_dims ( self . overlap_y_2 , axis = 2 ) * phi_product y_overlap_phi = - 0.5 * self . overlap_y * phi mapping_comp_a = - overlap_ua * self . constant_k return phi , phi_product , overlap_ua , [ y_overlap_2_phi_2 , y_overlap_phi , mapping_comp_a ]