(self, data_inst)
return data_output
:param data_inst: Table, only the key column of the Table is used
        :return:
def fit(self, data_inst):
        """

        :param data_inst: Table, only the key column of the Table is used
        :return:
        """
        abnormal_detection.empty_table_detection(data_inst)

        # 0. Raw retrieval
        match_data = data_inst
        self.with_inst_id = data_overview.check_with_inst_id(data_inst)
        if self.with_inst_id:
            match_data = self._recover_match_id(data_inst)

        if self.model_param.raw_retrieval or self.security_level == 0:
            LOGGER.info("enter raw information retrieval guest")
            # abnormal_detection.empty_table_detection(data_inst)
            data_output = self._raw_information_retrieval(match_data)
            self._display_result(block_num='N/A')
            if self.with_inst_id:
                data_output = self._restore_sample_id(data_output)
            data_output = self._compensate_set_difference(data_inst, data_output)
            return data_output

        # 1. Data pre-processing
        LOGGER.info("enter secure information retrieval guest")
        self.need_label = self._check_need_label()
        # abnormal_detection.empty_table_detection(data_inst)
        self._parse_security_level(match_data)
        if not self._check_oblivious_transfer_condition():
            self._failure_response()

        # 2. Find intersection
        id_list_intersect = self.intersection_obj.get_intersect_doubly_encrypted_id(match_data)[0]
        id_list_host_second_only = self.intersection_obj.id_list_remote_second[0]

        # 3. Send the re-indexed doubly encrypted ID to host
        self._fake_blocks(id_list_intersect, id_list_host_second_only)  # List[(EEi, -1)]
        LOGGER.info("faked blocks for obfuscation")

        # 4. Wait for host to restore value for the intersection
        LOGGER.info("waiting for host to restore interested values for the intersection")

        # 5. Execute OT as receiver
        LOGGER.info("enter oblivious transfer protocol as a receiver")
        target_key = self.oblivious_transfer.key_derivation(self.target_block_index)
        LOGGER.info("oblivious transfer key derived")

        # 6. Wait for host to encrypt and transmit, and then receive the encrypted interested values
        id_block_ciphertext, nonce = self._iteratively_get_encrypted_values()
        LOGGER.info("got encrypted interested values and nonce")
        target_block_cipher_id = self._non_committing_decrypt(
            id_block_ciphertext, nonce, target_key)  # (Eright, val)
        LOGGER.info("used the right key to decrypt the wanted values")

        # 7. Get (EEright, instance)
        target_block_cipher_cipher_id = self.intersection_obj.map_raw_id_to_encrypt_id(target_block_cipher_id,
                                                                                       id_list_host_second_only,
                                                                                       keep_value=True)
        # 8. Get (EEright, Eright_guest)
        id_list_local_first = self.intersection_obj.id_list_local_first[0] # (Eright_guest, id)
        id_list_local_second = self.intersection_obj.id_list_local_second[0] #(EEright, Eright_guest)

        # 9. Merge result
        # (Eright_guest, instance)
        id_list_cipher = self._merge_instance(target_block_cipher_cipher_id, id_list_local_second, self.need_label)
        data_output = self._merge(id_list_cipher, id_list_local_first)

        if self.with_inst_id:
            data_output = self._restore_sample_id(data_output)
        data_output = self._compensate_set_difference(data_inst, data_output)
        self._display_result()
        LOGGER.info("secure information retrieval finished")

        return data_output
def fit ( self , data_inst ) : abnormal_detection . empty_table_detection ( data_inst ) # 0. Raw retrieval match_data = data_inst self . with_inst_id = data_overview . check_with_inst_id ( data_inst ) if self . with_inst_id : match_data = self . _recover_match_id ( data_inst ) if self . model_param . raw_retrieval or self . security_level == 0 : LOGGER . info ( "enter raw information retrieval guest" ) # abnormal_detection.empty_table_detection(data_inst) data_output = self . _raw_information_retrieval ( match_data ) self . _display_result ( block_num = 'N/A' ) if self . with_inst_id : data_output = self . _restore_sample_id ( data_output ) data_output = self . _compensate_set_difference ( data_inst , data_output ) return data_output # 1. Data pre-processing LOGGER . info ( "enter secure information retrieval guest" ) self . need_label = self . _check_need_label ( ) # abnormal_detection.empty_table_detection(data_inst) self . _parse_security_level ( match_data ) if not self . _check_oblivious_transfer_condition ( ) : self . _failure_response ( ) # 2. Find intersection id_list_intersect = self . intersection_obj . get_intersect_doubly_encrypted_id ( match_data ) [ 0 ] id_list_host_second_only = self . intersection_obj . id_list_remote_second [ 0 ] # 3. Send the re-indexed doubly encrypted ID to host self . _fake_blocks ( id_list_intersect , id_list_host_second_only ) # List[(EEi, -1)] LOGGER . info ( "faked blocks for obfuscation" ) # 4. Wait for host to restore value for the intersection LOGGER . info ( "waiting for host to restore interested values for the intersection" ) # 5. Execute OT as receiver LOGGER . info ( "enter oblivious transfer protocol as a receiver" ) target_key = self . oblivious_transfer . key_derivation ( self . target_block_index ) LOGGER . info ( "oblivious transfer key derived" ) # 6. Wait for host to encrypt and transmit, and then receive the encrypted interested values id_block_ciphertext , nonce = self . _iteratively_get_encrypted_values ( ) LOGGER . info ( "got encrypted interested values and nonce" ) target_block_cipher_id = self . _non_committing_decrypt ( id_block_ciphertext , nonce , target_key ) # (Eright, val) LOGGER . info ( "used the right key to decrypt the wanted values" ) # 7. Get (EEright, instance) target_block_cipher_cipher_id = self . intersection_obj . map_raw_id_to_encrypt_id ( target_block_cipher_id , id_list_host_second_only , keep_value = True ) # 8. Get (EEright, Eright_guest) id_list_local_first = self . intersection_obj . id_list_local_first [ 0 ] # (Eright_guest, id) id_list_local_second = self . intersection_obj . id_list_local_second [ 0 ] #(EEright, Eright_guest) # 9. Merge result # (Eright_guest, instance) id_list_cipher = self . _merge_instance ( target_block_cipher_cipher_id , id_list_local_second , self . need_label ) data_output = self . _merge ( id_list_cipher , id_list_local_first ) if self . with_inst_id : data_output = self . _restore_sample_id ( data_output ) data_output = self . _compensate_set_difference ( data_inst , data_output ) self . _display_result ( ) LOGGER . info ( "secure information retrieval finished" ) return data_output