Пример #1
0
    def _get_param(self):
        pb_dict = {}
        for col_name, pair_obj in self.col_maps.items():
            values = [str(x) for x in pair_obj.values]
            value_dict_obj = onehot_param_pb2.ColsMap(values=values,
                                                      transformed_headers=pair_obj.transformed_headers)
            pb_dict[col_name] = value_dict_obj

        result_obj = onehot_param_pb2.OneHotParam(col_map=pb_dict,
                                                  result_header=self.inner_param.result_header)
        return result_obj
Пример #2
0
    def _get_param(self):
        pb_dict = {}
        LOGGER.debug("in save model, col_maps: {}".format(self.col_maps))
        for col_name, value_dict in self.col_maps.items():
            values = list(value_dict.keys())
            values = sorted(values)
            LOGGER.debug("In _get_param, values: {}".format(values))
            data_type = type(values[0]).__name__
            encoded_variables = []
            for v in values:
                encoded_variables.append(value_dict[v])
            values = [str(x) for x in values]

            value_dict_obj = onehot_param_pb2.ColsMap(
                values=values,
                encoded_variables=encoded_variables,
                data_type=data_type)
            pb_dict[col_name] = value_dict_obj

        result_obj = onehot_param_pb2.OneHotParam(col_map=pb_dict)
        return result_obj