예제 #1
0
 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"}
             }
예제 #2
0
 def test_initializer(self):
     initializer = Initializer()
     data_shape = 10
     init_param_obj = InitParam(init_method=consts.RANDOM_NORMAL,
                                init_const=20,
                                fit_intercept=False
                                )
     model = initializer.init_model(model_shape=data_shape, init_params=init_param_obj)
     model_shape = np.array(model).shape
     self.assertTrue(model_shape == (10,))
예제 #3
0
 def setUp(self):
     self.init_param = InitParam()
     self.boosting_tree_param = BoostingTreeParam()
     import json
     import time
     config_dict = \
         {"InitParam": {"init_method": "test_init", "fit_intercept": False},
          "DecisionTreeParam": {"criterion_method": "test_decisiontree"},
          "BoostingTreeParam": {"task_type": "test_boostingtree"}}
     config_json = json.dumps(config_dict)
     timeid = int(time.time() * 1000)
     self.config_path = "param_config_test." + str(timeid)
     with open(self.config_path, "w") as fout:
         fout.write(config_json)
예제 #4
0
 def test_directly_extract(self):
     init_param = InitParam()
     extractor = ParamExtract()
     init_param = extractor.parse_param_from_config(init_param,
                                                    self.config_path)
     self.assertTrue(init_param.init_method == "test_init")