def get_model_param(self):

        _, model_param = super(HeteroFastSecureBoostingTreeHost,
                               self).get_model_param()
        param_name = consts.HETERO_FAST_SBT_HOST_MODEL + "Param"
        model_param.tree_plan.extend(plan.encode_plan(self.tree_plan))
        model_param.model_name = consts.HETERO_FAST_SBT_MIX if self.work_mode == consts.MIX_TREE else \
                                 consts.HETERO_FAST_SBT_LAYERED
        # in mix mode, host can output feature importance
        feature_importances = list(self.feature_importances_.items())
        feature_importances = sorted(feature_importances,
                                     key=itemgetter(1),
                                     reverse=True)
        feature_importance_param = []
        LOGGER.debug('host feat importance is {}'.format(feature_importances))
        for fid, importance in feature_importances:
            feature_importance_param.append(
                FeatureImportanceInfo(
                    sitename=self.role,
                    fid=fid,
                    importance=importance.importance,
                    fullname=self.feature_name_fid_mapping[fid]))
        model_param.feature_importances.extend(feature_importance_param)

        return param_name, model_param
Esempio n. 2
0
    def get_model_param(self):

        _, model_param = super(HeteroFastSecureBoostingTreeGuest, self).get_model_param()
        param_name = "HeteroFastSecureBoostingTreeGuestParam"
        model_param.tree_plan.extend(plan.encode_plan(self.tree_plan))
        model_param.model_name = consts.HETERO_FAST_SBT_MIX if self.work_mode == consts.MIX_TREE else \
                                 consts.HETERO_FAST_SBT_LAYERED

        return param_name, model_param