Example #1
0
    def setUp(self):
        self.job_id = str(uuid.uuid1())
        self.session = Session.create(0, 0).init_computing(self.job_id).computing
        model = HeteroStepwise()
        model.__setattr__('role', consts.GUEST)
        model.__setattr__('fit_intercept', True)

        self.model = model
        data_num = 100
        feature_num = 5
        bool_list = [True, False, True, True, False]
        self.str_mask = "10110"
        self.header = ["x1", "x2", "x3", "x4", "x5"]
        self.mask = self.prepare_mask(bool_list)
        self.table = self.prepare_data(data_num, feature_num, self.header, "id", "y")
Example #2
0
 def setUp(self):
     self.job_id = str(uuid.uuid1())
     self.session = Session.create(0,
                                   0).init_computing(self.job_id).computing
     self.data_splitter = data_split.DataSplitter()
     param_dict = {
         "random_state": 42,
         "test_size": 0.2,
         "train_size": 0.6,
         "validate_size": 0.2,
         "stratified": True,
         "shuffle": True,
         "split_points": [0.5, 0.2]
     }
     params = DataSplitParam(**param_dict)
     self.data_splitter._init_model(params)
Example #3
0
 def setUp(self):
     self.job_id = str(uuid.uuid1())
     self.session = Session.create(0,
                                   0).init_computing(self.job_id).computing
     data_num = 100
     feature_num = 8
     self.prepare_data(data_num, feature_num)
     params = LocalBaselineParam()
     local_baseline_obj = LocalBaseline()
     local_baseline_obj._init_model(params)
     local_baseline_obj.need_run = True
     local_baseline_obj.header = [
         "x1", "x2", "x3", "x4", "x5", "x6", "x7", "x8"
     ]
     local_baseline_obj.model_name = "LogisticRegression"
     local_baseline_obj.model_opts = {}
     self.local_baseline_obj = local_baseline_obj
                        type=str,
                        help="host party id",
                        default='10000')
    parser.add_argument('-j',
                        '--job_id',
                        required=True,
                        type=str,
                        help="job_id")

    args = parser.parse_args()
    job_id = args.job_id
    guest_id = args.gid
    host_id = args.hid
    role = args.role

    with Session.create(0, 0) as session:
        session.init_computing(job_id)
        session.init_federation(
            federation_session_id=job_id,
            parties_info=PartiesInfo(local=Party(
                role, guest_id if role == GUEST else host_id),
                                     role_to_parties={
                                         "host": [Party("host", host_id)],
                                         "guest": [Party("guest", guest_id)]
                                     }))

        test_obj = TestHeteroFeatureBinning(role, guest_id, host_id)
        # homo_obj.test_homo_lr()
        test_obj.test_feature_binning()
        test_obj.tearDown()