Пример #1
0
    def _get_param(self):
        if self.filter_result is None:
            result_obj = feature_selection_param_pb2.FeatureSelectionParam()
            return result_obj

        LOGGER.debug("in _get_param, self.left_cols: {}, self.original_header: {}".format(
            self.filter_result.get_left_cols, self.header
        ))

        left_col_obj = feature_selection_param_pb2.LeftCols(original_cols=self.header,
                                                            left_cols=self.filter_result.get_left_cols())

        # col_names = self.__make_cols_list(self.cols_list)
        # host_col_names = self.__make_cols_list(self.host_cols_list)
        if self.party_name == consts.GUEST:
            host_col_names = self.host_filter_result.get_sorted_col_names()
        else:
            host_col_names = []

        result_obj = feature_selection_param_pb2.FeatureSelectionParam(
            results=self.results,
            final_left_cols=left_col_obj,
            col_names=self.filter_result.get_sorted_col_names(),
            host_col_names=host_col_names,
            header=self.header
        )

        json_result = json_format.MessageToJson(result_obj)
        LOGGER.debug("json_result: {}".format(json_result))
        return result_obj
Пример #2
0
    def _get_param(self):
        LOGGER.debug(
            "curt_select_properties.left_col_name: {}, completed_selection_result: {}"
            .format(self.curt_select_properties.left_col_names,
                    self.completed_selection_result.all_left_col_names))
        LOGGER.debug("Length of left cols: {}".format(
            len(self.completed_selection_result.all_left_col_names)))
        # left_cols = {x: True for x in self.curt_select_properties.left_col_names}
        left_cols = {
            x: True
            for x in self.completed_selection_result.all_left_col_names
        }
        final_left_cols = feature_selection_param_pb2.LeftCols(
            original_cols=self.completed_selection_result.get_select_col_names(
            ),
            left_cols=left_cols)

        host_col_names = []
        if self.role == consts.GUEST:
            for host_id, this_host_name in enumerate(
                    self.completed_selection_result.get_host_sorted_col_names(
                    )):
                party_id = self.component_properties.host_party_idlist[host_id]
                LOGGER.debug(
                    "In _get_param, this_host_name: {}, party_id: {}".format(
                        this_host_name, party_id))

                host_col_names.append(
                    feature_selection_param_pb2.HostColNames(
                        col_names=this_host_name, party_id=str(party_id)))
        else:
            party_id = self.component_properties.local_partyid
            anonymous_names = [
                anonymous_generator.generate_anonymous(fid, model=self)
                for fid in range(len(self.header))
            ]
            host_col_names.append(
                feature_selection_param_pb2.HostColNames(
                    col_names=anonymous_names, party_id=str(party_id)))

        result_obj = feature_selection_param_pb2.FeatureSelectionParam(
            results=self.completed_selection_result.filter_results,
            final_left_cols=final_left_cols,
            col_names=self.completed_selection_result.get_sorted_col_names(),
            host_col_names=host_col_names,
            header=self.curt_select_properties.header)

        # json_result = json_format.MessageToJson(result_obj)
        # LOGGER.debug("json_result: {}".format(json_result))
        return result_obj
    def _get_param(self):
        LOGGER.debug(
            "curt_select_properties.left_col_name: {}, completed_selection_result: {}"
            .format(self.curt_select_properties.left_col_names,
                    self.completed_selection_result.all_left_col_names))
        LOGGER.debug("Length of left cols: {}".format(
            len(self.completed_selection_result.all_left_col_names)))
        # left_cols = {x: True for x in self.curt_select_properties.left_col_names}
        left_cols = {
            x: True
            for x in self.completed_selection_result.all_left_col_names
        }
        final_left_cols = feature_selection_param_pb2.LeftCols(
            original_cols=self.completed_selection_result.get_select_col_names(
            ),
            left_cols=left_cols)

        host_col_names = []
        for host_id, this_host_name in enumerate(
                self.completed_selection_result.get_host_sorted_col_names()):
            party_id = self.component_properties.host_party_idlist[host_id]
            LOGGER.debug(
                "In _get_param, this_host_name: {}, party_id: {}".format(
                    this_host_name, party_id))

            host_col_names.append(
                feature_selection_param_pb2.HostColNames(
                    col_names=this_host_name, party_id=str(party_id)))

        result_obj = feature_selection_param_pb2.FeatureSelectionParam(
            results=self.completed_selection_result.filter_results,
            final_left_cols=final_left_cols,
            col_names=self.completed_selection_result.get_sorted_col_names(),
            host_col_names=host_col_names,
            header=self.curt_select_properties.header)

        json_result = json_format.MessageToJson(result_obj)
        LOGGER.debug("json_result: {}".format(json_result))
        return result_obj