def __init__(self): super(HeteroSecureBoostingTreeHost, self).__init__() self.use_missing = False self.zero_as_missing = False self.grad_and_hess = None self.tree_param = DecisionTreeParam() # decision tree param self.model_param = HeteroSecureBoostParam() self.complete_secure = False self.model_name = 'HeteroSecureBoost' self.enable_goss = False self.cipher_compressing = False self.max_sample_weight = None self.round_decimal = None self.new_ver = True self.boosting_strategy = consts.STD_TREE # fast sbt param self.tree_num_per_party = 1 self.guest_depth = 0 self.host_depth = 0 self.init_tree_plan = False self.tree_plan = [] self.feature_importances_ = {} # EINI predict param self.EINI_inference = False self.EINI_random_mask = False self.EINI_complexity_check = False self.multi_mode = consts.SINGLE_OUTPUT self.hetero_sbt_transfer_variable = HeteroSecureBoostTransferVariable()
def test_param_embedding(self): boosting_tree_param = HeteroSecureBoostParam() extractor = ParamExtract() boosting_tree_param = extractor.parse_param_from_config( boosting_tree_param, self.config_dict) print("boosting_tree_param.tree_param.criterion_method {}".format( boosting_tree_param.tree_param.criterion_method)) self.assertTrue(boosting_tree_param.tree_param.criterion_method == "test_decisiontree")
def setUp(self): self.init_param = InitParam() self.boosting_tree_param = HeteroSecureBoostParam() self.config_dict = \ {"HeteroSecureBoostParam": { "init_param": {"init_method": "test_init", "fit_intercept": False}, "tree_param": {"criterion_method": "test_decisiontree"}, "task_type": "test_boostingtree", "test_variable": "test"} }
def __init__(self): super(HeteroSecureBoostingTreeGuest, self).__init__() self.tree_param = None # decision tree param self.use_missing = False self.zero_as_missing = False self.cur_epoch_idx = -1 self.grad_and_hess = None self.feature_importances_ = {} self.model_param = HeteroSecureBoostParam() self.complete_secure = False self.data_alignment_map = {} self.predict_transfer_inst = HeteroSecureBoostTransferVariable() self.model_name = 'HeteroSecureBoost'
def __init__(self): super(HeteroSecureBoostingTreeHost, self).__init__() self.tree_param = None # decision tree param self.use_missing = False self.zero_as_missing = False self.cur_epoch_idx = -1 self.grad_and_hess = None self.model_param = HeteroSecureBoostParam() self.complete_secure = False self.model_name = 'HeteroSecureBoost' # for fast hist self.sparse_opt_para = False self.run_sparse_opt = False self.has_transformed_data = False self.data_bin_dense = None self.predict_transfer_inst = HeteroSecureBoostTransferVariable()
def __init__(self): super(HeteroSecureBoostingTreeGuest, self).__init__() self.tree_param = DecisionTreeParam() # decision tree param self.use_missing = False self.zero_as_missing = False self.cur_epoch_idx = -1 self.grad_and_hess = None self.feature_importances_ = {} self.model_param = HeteroSecureBoostParam() self.complete_secure = False self.data_alignment_map = {} self.hetero_sbt_transfer_variable = HeteroSecureBoostTransferVariable() self.model_name = 'HeteroSecureBoost' self.max_sample_weight = 1 self.max_sample_weight_computed = False self.re_compute_goss_sample_weight = False self.cipher_compressing = False self.enable_goss = False # GOSS self.top_rate = None self.other_rate = None self.new_ver = True self.boosting_strategy = consts.STD_TREE # default work mode is std # fast sbt param self.tree_num_per_party = 1 self.guest_depth = 0 self.host_depth = 0 self.init_tree_plan = False self.tree_plan = [] # multi-classification mode self.multi_mode = consts.SINGLE_OUTPUT # EINI predict param self.EINI_inference = False self.EINI_random_mask = False
def __init__(self): super(HeteroSecureBoostingTreeHost, self).__init__() self.use_missing = False self.zero_as_missing = False self.cur_epoch_idx = -1 self.grad_and_hess = None self.tree_param = DecisionTreeParam() # decision tree param self.model_param = HeteroSecureBoostParam() self.complete_secure = False self.model_name = 'HeteroSecureBoost' self.enable_goss = False self.cipher_compressing = False self.max_sample_weight = None self.round_decimal = None self.new_ver = True # for fast hist self.sparse_opt_para = False self.run_sparse_opt = False self.has_transformed_data = False self.data_bin_dense = None self.predict_transfer_inst = HeteroSecureBoostTransferVariable()
def __init__(self): super(HeteroSecureBoostingTreeGuest, self).__init__() self.tree_param = DecisionTreeParam() # decision tree param self.use_missing = False self.zero_as_missing = False self.cur_epoch_idx = -1 self.grad_and_hess = None self.feature_importances_ = {} self.model_param = HeteroSecureBoostParam() self.complete_secure = False self.data_alignment_map = {} self.predict_transfer_inst = HeteroSecureBoostTransferVariable() self.model_name = 'HeteroSecureBoost' self.max_sample_weight = 1 self.max_sample_weight_computed = False self.cipher_compressing = False self.enable_goss = False # GOSS self.top_rate = None self.other_rate = None self.new_ver = True
def test_undefine_variable_extract(self): boosting_tree_param = HeteroSecureBoostParam() extractor = ParamExtract() boosting_tree_param = extractor.parse_param_from_config( boosting_tree_param, self.config_dict) self.assertTrue(not hasattr(boosting_tree_param, "test_variable"))
def test_directly_extract(self): boosting_tree_param = HeteroSecureBoostParam() extractor = ParamExtract() boosting_tree_param = extractor.parse_param_from_config( boosting_tree_param, self.config_dict) self.assertTrue(boosting_tree_param.task_type == "test_boostingtree")