(self, data_instances)
return data_instances
This function allows for one-hot-encoding of the 
        columns with or without alignment with the other parties
        in the federated learning.

        Args:
            data_instances: data the guest has access to

        Returns:
            if alignment is on, then the one-hot-encoding data_instances are done with
            alignment with parties involved in federated learning else,
            the data is one-hot-encoded independently
This function allows for one-hot-encoding of the 
        columns with or without alignment with the other parties
        in the federated learning.
This function allows for one - hot - encoding of the columns with or without alignment with the other parties in the federated learning .
def fit(self, data_instances):
        """This function allows for one-hot-encoding of the 
        columns with or without alignment with the other parties
        in the federated learning.

        Args:
            data_instances: data the guest has access to

        Returns:
            if alignment is on, then the one-hot-encoding data_instances are done with
            alignment with parties involved in federated learning else,
            the data is one-hot-encoded independently

        """

        self._init_params(data_instances)
        self._abnormal_detection(data_instances)
        # keep a copy of original header
        ori_header = self.inner_param.header.copy()

        # obtain the individual column headers with their values
        f1 = functools.partial(self.record_new_header,
                               inner_param=self.inner_param)
        self.col_maps = data_instances.applyPartitions(f1).reduce(self.merge_col_maps)
        col_maps = {}
        for col_name, pair_obj in self.col_maps.items():
            values = [x for x in pair_obj.values]
            col_maps[col_name] = values

        # LOGGER.debug("new col_maps is: {}".format(col_maps))

        if self.need_alignment:

            # Send col_maps to arbiter
            if self.role == consts.HOST:
                self.transfer_variable.host_columns.remote(col_maps, role=consts.ARBITER, idx=-1)
            elif self.role == consts.GUEST:
                self.transfer_variable.guest_columns.remote(col_maps, role=consts.ARBITER, idx=-1)

                # Receive aligned columns from arbiter
            aligned_columns = self.transfer_variable.aligned_columns.get(idx=-1)
            aligned_col_maps = aligned_columns[0]
            # LOGGER.debug("{} aligned columns received are: {}".format(self.role, aligned_col_maps))

            self.col_maps = {}
            for col_name, value_list in aligned_col_maps.items():
                value_set = set([str(x) for x in value_list])
                if len(value_set) != len(value_list):
                    raise ValueError("Same values with different types have occurred among different parties")

                transfer_pair = one_hot_encoder.TransferPair(col_name)
                for v in value_list:
                    transfer_pair.add_value(v)
                self.col_maps[col_name] = transfer_pair

        self._transform_schema()

        data_instances = self.transform(data_instances)
        # LOGGER.debug(
        #     "[Result][OHEAlignment{}] After transform in fit, schema is : {}, header: {}".format(self.role, self.schema,
        #                                                                                          self.inner_param.header))

        return data_instances
def fit ( self , data_instances ) : self . _init_params ( data_instances ) self . _abnormal_detection ( data_instances ) # keep a copy of original header ori_header = self . inner_param . header . copy ( ) # obtain the individual column headers with their values f1 = functools . partial ( self . record_new_header , inner_param = self . inner_param ) self . col_maps = data_instances . applyPartitions ( f1 ) . reduce ( self . merge_col_maps ) col_maps = { } for col_name , pair_obj in self . col_maps . items ( ) : values = [ x for x in pair_obj . values ] col_maps [ col_name ] = values # LOGGER.debug("new col_maps is: {}".format(col_maps)) if self . need_alignment : # Send col_maps to arbiter if self . role == consts . HOST : self . transfer_variable . host_columns . remote ( col_maps , role = consts . ARBITER , idx = - 1 ) elif self . role == consts . GUEST : self . transfer_variable . guest_columns . remote ( col_maps , role = consts . ARBITER , idx = - 1 ) # Receive aligned columns from arbiter aligned_columns = self . transfer_variable . aligned_columns . get ( idx = - 1 ) aligned_col_maps = aligned_columns [ 0 ] # LOGGER.debug("{} aligned columns received are: {}".format(self.role, aligned_col_maps)) self . col_maps = { } for col_name , value_list in aligned_col_maps . items ( ) : value_set = set ( [ str ( x ) for x in value_list ] ) if len ( value_set ) != len ( value_list ) : raise ValueError ( "Same values with different types have occurred among different parties" ) transfer_pair = one_hot_encoder . TransferPair ( col_name ) for v in value_list : transfer_pair . add_value ( v ) self . col_maps [ col_name ] = transfer_pair self . _transform_schema ( ) data_instances = self . transform ( data_instances ) # LOGGER.debug( #     "[Result][OHEAlignment{}] After transform in fit, schema is : {}, header: {}".format(self.role, self.schema, #                                                                                          self.inner_param.header)) return data_instances