From 30304d5b391be01b7418aaaf1ec3400a31bc820a Mon Sep 17 00:00:00 2001 From: qbc Date: Thu, 30 Mar 2023 20:45:52 +0800 Subject: [PATCH 1/7] rename, need add readme --- federatedscope/core/configs/cfg_fl_setting.py | 3 ++- ....yaml => gbdt_feature_gathering_on_abalone.yaml} | 0 ...lt.yaml => gbdt_feature_gathering_on_adult.yaml} | 0 ...ult.yaml => gbdt_label_scattering_on_adult.yaml} | 0 ...ne.yaml => rf_feature_gathering_on_abalone.yaml} | 0 ...dult.yaml => rf_feature_gathering_on_adult.yaml} | 0 ...adult.yaml => rf_label_scattering_on_adult.yaml} | 2 +- ...aml => xgb_feature_gathering_dp_on_abalone.yaml} | 0 ....yaml => xgb_feature_gathering_dp_on_adult.yaml} | 0 ...e.yaml => xgb_feature_gathering_on_abalone.yaml} | 0 ...ult.yaml => xgb_feature_gathering_on_adult.yaml} | 0 ... xgb_feature_gathering_on_adult_by_he_eval.yaml} | 0 ...back.yaml => xgb_feature_gathering_on_blog.yaml} | 0 ...it.yaml => xgb_feature_gathering_on_credit.yaml} | 0 ...=> xgb_feature_gathering_op_boost_on_adult.yaml} | 0 ...ne.yaml => xgb_label_scattering_on_abalone.yaml} | 2 +- ...dult.yaml => xgb_label_scattering_on_adult.yaml} | 2 +- .../tree_based_models/trainer/trainer.py | 6 +++--- .../tree_based_models/worker/TreeClient.py | 13 +++++++------ tests/test_tree_based_model_for_vfl.py | 8 ++++---- 20 files changed, 19 insertions(+), 17 deletions(-) rename federatedscope/vertical_fl/tree_based_models/baseline/{gbdt_base_on_abalone.yaml => gbdt_feature_gathering_on_abalone.yaml} (100%) rename federatedscope/vertical_fl/tree_based_models/baseline/{gbdt_base_on_adult.yaml => gbdt_feature_gathering_on_adult.yaml} (100%) rename federatedscope/vertical_fl/tree_based_models/baseline/{gbdt_label_base_on_adult.yaml => gbdt_label_scattering_on_adult.yaml} (100%) rename federatedscope/vertical_fl/tree_based_models/baseline/{rf_base_on_abalone.yaml => rf_feature_gathering_on_abalone.yaml} (100%) rename federatedscope/vertical_fl/tree_based_models/baseline/{rf_base_on_adult.yaml => rf_feature_gathering_on_adult.yaml} (100%) rename federatedscope/vertical_fl/tree_based_models/baseline/{rf_label_base_on_adult.yaml => rf_label_scattering_on_adult.yaml} (96%) rename federatedscope/vertical_fl/tree_based_models/baseline/{xgb_feature_order_dp_on_abalone.yaml => xgb_feature_gathering_dp_on_abalone.yaml} (100%) rename federatedscope/vertical_fl/tree_based_models/baseline/{xgb_feature_order_dp_on_adult.yaml => xgb_feature_gathering_dp_on_adult.yaml} (100%) rename federatedscope/vertical_fl/tree_based_models/baseline/{xgb_base_on_abalone.yaml => xgb_feature_gathering_on_abalone.yaml} (100%) rename federatedscope/vertical_fl/tree_based_models/baseline/{xgb_base_on_adult.yaml => xgb_feature_gathering_on_adult.yaml} (100%) rename federatedscope/vertical_fl/tree_based_models/baseline/{xgb_base_on_adult_by_he_eval.yaml => xgb_feature_gathering_on_adult_by_he_eval.yaml} (100%) rename federatedscope/vertical_fl/tree_based_models/baseline/{xgb_base_on_blogfeedback.yaml => xgb_feature_gathering_on_blog.yaml} (100%) rename federatedscope/vertical_fl/tree_based_models/baseline/{xgb_base_on_givemesomecredit.yaml => xgb_feature_gathering_on_credit.yaml} (100%) rename federatedscope/vertical_fl/tree_based_models/baseline/{xgb_feature_order_op_boost_on_adult.yaml => xgb_feature_gathering_op_boost_on_adult.yaml} (100%) rename federatedscope/vertical_fl/tree_based_models/baseline/{xgb_label_base_on_abalone.yaml => xgb_label_scattering_on_abalone.yaml} (96%) rename federatedscope/vertical_fl/tree_based_models/baseline/{xgb_label_based_on_adult.yaml => xgb_label_scattering_on_adult.yaml} (95%) diff --git a/federatedscope/core/configs/cfg_fl_setting.py b/federatedscope/core/configs/cfg_fl_setting.py index 1e31e727f..d88ade4fe 100644 --- a/federatedscope/core/configs/cfg_fl_setting.py +++ b/federatedscope/core/configs/cfg_fl_setting.py @@ -82,7 +82,8 @@ def extend_fl_setting_cfg(cfg): # ---------------------------------------------------------------------- # cfg.vertical = CN() cfg.vertical.use = False - cfg.vertical.mode = 'order_based' # ['order_based', 'label_based'] + cfg.vertical.mode = 'feature_gathering' + # ['feature_gathering', 'label_scattering'] cfg.vertical.dims = [5, 10] # TODO: we need to explain dims cfg.vertical.encryption = 'paillier' cfg.vertical.key_size = 3072 diff --git a/federatedscope/vertical_fl/tree_based_models/baseline/gbdt_base_on_abalone.yaml b/federatedscope/vertical_fl/tree_based_models/baseline/gbdt_feature_gathering_on_abalone.yaml similarity index 100% rename from federatedscope/vertical_fl/tree_based_models/baseline/gbdt_base_on_abalone.yaml rename to federatedscope/vertical_fl/tree_based_models/baseline/gbdt_feature_gathering_on_abalone.yaml diff --git a/federatedscope/vertical_fl/tree_based_models/baseline/gbdt_base_on_adult.yaml b/federatedscope/vertical_fl/tree_based_models/baseline/gbdt_feature_gathering_on_adult.yaml similarity index 100% rename from federatedscope/vertical_fl/tree_based_models/baseline/gbdt_base_on_adult.yaml rename to federatedscope/vertical_fl/tree_based_models/baseline/gbdt_feature_gathering_on_adult.yaml diff --git a/federatedscope/vertical_fl/tree_based_models/baseline/gbdt_label_base_on_adult.yaml b/federatedscope/vertical_fl/tree_based_models/baseline/gbdt_label_scattering_on_adult.yaml similarity index 100% rename from federatedscope/vertical_fl/tree_based_models/baseline/gbdt_label_base_on_adult.yaml rename to federatedscope/vertical_fl/tree_based_models/baseline/gbdt_label_scattering_on_adult.yaml diff --git a/federatedscope/vertical_fl/tree_based_models/baseline/rf_base_on_abalone.yaml b/federatedscope/vertical_fl/tree_based_models/baseline/rf_feature_gathering_on_abalone.yaml similarity index 100% rename from federatedscope/vertical_fl/tree_based_models/baseline/rf_base_on_abalone.yaml rename to federatedscope/vertical_fl/tree_based_models/baseline/rf_feature_gathering_on_abalone.yaml diff --git a/federatedscope/vertical_fl/tree_based_models/baseline/rf_base_on_adult.yaml b/federatedscope/vertical_fl/tree_based_models/baseline/rf_feature_gathering_on_adult.yaml similarity index 100% rename from federatedscope/vertical_fl/tree_based_models/baseline/rf_base_on_adult.yaml rename to federatedscope/vertical_fl/tree_based_models/baseline/rf_feature_gathering_on_adult.yaml diff --git a/federatedscope/vertical_fl/tree_based_models/baseline/rf_label_base_on_adult.yaml b/federatedscope/vertical_fl/tree_based_models/baseline/rf_label_scattering_on_adult.yaml similarity index 96% rename from federatedscope/vertical_fl/tree_based_models/baseline/rf_label_base_on_adult.yaml rename to federatedscope/vertical_fl/tree_based_models/baseline/rf_label_scattering_on_adult.yaml index 52e04975b..aa73e9c99 100644 --- a/federatedscope/vertical_fl/tree_based_models/baseline/rf_label_base_on_adult.yaml +++ b/federatedscope/vertical_fl/tree_based_models/baseline/rf_label_scattering_on_adult.yaml @@ -29,7 +29,7 @@ vertical: use: True dims: [ 7, 14 ] algo: 'rf' - mode: 'label_based' + mode: 'label_scattering' data_size_for_debug: 2000 feature_subsample_ratio: 0.4 protect_object: 'grad_and_hess' diff --git a/federatedscope/vertical_fl/tree_based_models/baseline/xgb_feature_order_dp_on_abalone.yaml b/federatedscope/vertical_fl/tree_based_models/baseline/xgb_feature_gathering_dp_on_abalone.yaml similarity index 100% rename from federatedscope/vertical_fl/tree_based_models/baseline/xgb_feature_order_dp_on_abalone.yaml rename to federatedscope/vertical_fl/tree_based_models/baseline/xgb_feature_gathering_dp_on_abalone.yaml diff --git a/federatedscope/vertical_fl/tree_based_models/baseline/xgb_feature_order_dp_on_adult.yaml b/federatedscope/vertical_fl/tree_based_models/baseline/xgb_feature_gathering_dp_on_adult.yaml similarity index 100% rename from federatedscope/vertical_fl/tree_based_models/baseline/xgb_feature_order_dp_on_adult.yaml rename to federatedscope/vertical_fl/tree_based_models/baseline/xgb_feature_gathering_dp_on_adult.yaml diff --git a/federatedscope/vertical_fl/tree_based_models/baseline/xgb_base_on_abalone.yaml b/federatedscope/vertical_fl/tree_based_models/baseline/xgb_feature_gathering_on_abalone.yaml similarity index 100% rename from federatedscope/vertical_fl/tree_based_models/baseline/xgb_base_on_abalone.yaml rename to federatedscope/vertical_fl/tree_based_models/baseline/xgb_feature_gathering_on_abalone.yaml diff --git a/federatedscope/vertical_fl/tree_based_models/baseline/xgb_base_on_adult.yaml b/federatedscope/vertical_fl/tree_based_models/baseline/xgb_feature_gathering_on_adult.yaml similarity index 100% rename from federatedscope/vertical_fl/tree_based_models/baseline/xgb_base_on_adult.yaml rename to federatedscope/vertical_fl/tree_based_models/baseline/xgb_feature_gathering_on_adult.yaml diff --git a/federatedscope/vertical_fl/tree_based_models/baseline/xgb_base_on_adult_by_he_eval.yaml b/federatedscope/vertical_fl/tree_based_models/baseline/xgb_feature_gathering_on_adult_by_he_eval.yaml similarity index 100% rename from federatedscope/vertical_fl/tree_based_models/baseline/xgb_base_on_adult_by_he_eval.yaml rename to federatedscope/vertical_fl/tree_based_models/baseline/xgb_feature_gathering_on_adult_by_he_eval.yaml diff --git a/federatedscope/vertical_fl/tree_based_models/baseline/xgb_base_on_blogfeedback.yaml b/federatedscope/vertical_fl/tree_based_models/baseline/xgb_feature_gathering_on_blog.yaml similarity index 100% rename from federatedscope/vertical_fl/tree_based_models/baseline/xgb_base_on_blogfeedback.yaml rename to federatedscope/vertical_fl/tree_based_models/baseline/xgb_feature_gathering_on_blog.yaml diff --git a/federatedscope/vertical_fl/tree_based_models/baseline/xgb_base_on_givemesomecredit.yaml b/federatedscope/vertical_fl/tree_based_models/baseline/xgb_feature_gathering_on_credit.yaml similarity index 100% rename from federatedscope/vertical_fl/tree_based_models/baseline/xgb_base_on_givemesomecredit.yaml rename to federatedscope/vertical_fl/tree_based_models/baseline/xgb_feature_gathering_on_credit.yaml diff --git a/federatedscope/vertical_fl/tree_based_models/baseline/xgb_feature_order_op_boost_on_adult.yaml b/federatedscope/vertical_fl/tree_based_models/baseline/xgb_feature_gathering_op_boost_on_adult.yaml similarity index 100% rename from federatedscope/vertical_fl/tree_based_models/baseline/xgb_feature_order_op_boost_on_adult.yaml rename to federatedscope/vertical_fl/tree_based_models/baseline/xgb_feature_gathering_op_boost_on_adult.yaml diff --git a/federatedscope/vertical_fl/tree_based_models/baseline/xgb_label_base_on_abalone.yaml b/federatedscope/vertical_fl/tree_based_models/baseline/xgb_label_scattering_on_abalone.yaml similarity index 96% rename from federatedscope/vertical_fl/tree_based_models/baseline/xgb_label_base_on_abalone.yaml rename to federatedscope/vertical_fl/tree_based_models/baseline/xgb_label_scattering_on_abalone.yaml index 5bb875632..6498f2569 100644 --- a/federatedscope/vertical_fl/tree_based_models/baseline/xgb_label_base_on_abalone.yaml +++ b/federatedscope/vertical_fl/tree_based_models/baseline/xgb_label_scattering_on_abalone.yaml @@ -27,7 +27,7 @@ train: eta: 0.19 vertical: use: True - mode: 'label_based' + mode: 'label_scattering' dims: [6, 10] algo: 'xgb' data_size_for_debug: 0 diff --git a/federatedscope/vertical_fl/tree_based_models/baseline/xgb_label_based_on_adult.yaml b/federatedscope/vertical_fl/tree_based_models/baseline/xgb_label_scattering_on_adult.yaml similarity index 95% rename from federatedscope/vertical_fl/tree_based_models/baseline/xgb_label_based_on_adult.yaml rename to federatedscope/vertical_fl/tree_based_models/baseline/xgb_label_scattering_on_adult.yaml index 2006fdf84..349ccff10 100644 --- a/federatedscope/vertical_fl/tree_based_models/baseline/xgb_label_based_on_adult.yaml +++ b/federatedscope/vertical_fl/tree_based_models/baseline/xgb_label_scattering_on_adult.yaml @@ -27,7 +27,7 @@ train: eta: 0.5 vertical: use: True - mode: 'label_based' + mode: 'label_scattering' dims: [7, 14] algo: 'xgb' data_size_for_debug: 2000 diff --git a/federatedscope/vertical_fl/tree_based_models/trainer/trainer.py b/federatedscope/vertical_fl/tree_based_models/trainer/trainer.py index 153900f6d..3b463a595 100644 --- a/federatedscope/vertical_fl/tree_based_models/trainer/trainer.py +++ b/federatedscope/vertical_fl/tree_based_models/trainer/trainer.py @@ -94,7 +94,7 @@ def train(self, training_info=None, tree_num=0, node_num=None): # Start to build a tree if node_num is None: if training_info is not None and \ - self.cfg.vertical.mode == 'order_based': + self.cfg.vertical.mode == 'feature_gathering': self.merged_feature_order, self.extra_info = \ self._parse_training_info(training_info) return self._compute_for_root(tree_num=tree_num) @@ -274,7 +274,7 @@ def _compute_for_node(self, tree_num, node_num): return self._compute_for_node(tree_num, node_num + 1) # Calculate best gain else: - if self.cfg.vertical.mode == 'order_based': + if self.cfg.vertical.mode == 'feature_gathering': improved_flag, split_ref, _ = self._get_best_gain( tree_num, node_num) if improved_flag: @@ -290,7 +290,7 @@ def _compute_for_node(self, tree_num, node_num): else: self._set_weight_and_status(tree_num, node_num) return self._compute_for_node(tree_num, node_num + 1) - elif self.cfg.vertical.mode == 'label_based': + elif self.cfg.vertical.mode == 'label_scattering': results = (self.model[tree_num][node_num].grad, self.model[tree_num][node_num].hess, self.model[tree_num][node_num].indicator, tree_num, diff --git a/federatedscope/vertical_fl/tree_based_models/worker/TreeClient.py b/federatedscope/vertical_fl/tree_based_models/worker/TreeClient.py index d4afeece2..7c4234f09 100644 --- a/federatedscope/vertical_fl/tree_based_models/worker/TreeClient.py +++ b/federatedscope/vertical_fl/tree_based_models/worker/TreeClient.py @@ -88,14 +88,15 @@ def callback_func_for_data_sample(self, message: Message): index=batch_index) self.feature_order = feature_order_info['feature_order'] - if self._cfg.vertical.mode == 'order_based': + if self._cfg.vertical.mode == 'feature_gathering': training_info = feature_order_info - elif self._cfg.vertical.mode == 'label_based': + elif self._cfg.vertical.mode == 'label_scattering': training_info = 'dummy_info' else: - raise TypeError(f'The expected types of vertical.mode include ' - f'["label_based", "order_based"], but got ' - f'{self._cfg.vertical.mode}.') + raise TypeError( + f'The expected types of vertical.mode include ' + f'["label_scattering", "feature_gathering"], but got ' + f'{self._cfg.vertical.mode}.') self.comm_manager.send( Message(msg_type='training_info', @@ -122,7 +123,7 @@ def start_a_new_training_round(self, self.msg_buffer['train'].clear() self.feature_order = feature_order_info['feature_order'] self.msg_buffer['train'][self.ID] = feature_order_info \ - if self._cfg.vertical.mode == 'order_based' else 'dummy_info' + if self._cfg.vertical.mode == 'feature_gathering' else 'dummy_info' self.state = tree_num receiver = [ each for each in list(self.comm_manager.neighbors.keys()) diff --git a/tests/test_tree_based_model_for_vfl.py b/tests/test_tree_based_model_for_vfl.py index a1a518127..ebc7af011 100644 --- a/tests/test_tree_based_model_for_vfl.py +++ b/tests/test_tree_based_model_for_vfl.py @@ -270,7 +270,7 @@ def set_config_for_xgb_dp_too_large_noise(self, cfg): return backup_cfg - def set_config_for_label_based_xgb(self, cfg): + def set_config_for_label_scattering_xgb(self, cfg): backup_cfg = cfg.clone() import torch @@ -298,7 +298,7 @@ def set_config_for_label_based_xgb(self, cfg): cfg.vertical.use = True cfg.vertical.dims = [7, 14] cfg.vertical.algo = 'xgb' - cfg.vertical.mode = 'label_based' + cfg.vertical.mode = 'label_scattering' cfg.vertical.protect_object = 'grad_and_hess' cfg.vertical.protect_method = 'he' cfg.vertical.data_size_for_debug = 2000 @@ -533,9 +533,9 @@ def test_XGB_use_dp_too_large_noise(self): print(test_results) self.assertLess(test_results['server_global_eval']['test_acc'], 0.76) - def test_label_based_XGB(self): + def test_label_scattering_XGB(self): init_cfg = global_cfg.clone() - backup_cfg = self.set_config_for_label_based_xgb(init_cfg) + backup_cfg = self.set_config_for_label_scattering_xgb(init_cfg) setup_seed(init_cfg.seed) update_logger(init_cfg, True) From fbf004899251687e82164fab3012d76434a4c523 Mon Sep 17 00:00:00 2001 From: qbc Date: Thu, 30 Mar 2023 20:51:10 +0800 Subject: [PATCH 2/7] minor changes --- federatedscope/vertical_fl/tree_based_models/model/Tree.py | 3 ++- .../tree_based_models/trainer/label_protected_trainer.py | 2 +- tests/test_tree_based_model_for_vfl.py | 4 ++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/federatedscope/vertical_fl/tree_based_models/model/Tree.py b/federatedscope/vertical_fl/tree_based_models/model/Tree.py index d0ac1b586..d0d78ce5b 100644 --- a/federatedscope/vertical_fl/tree_based_models/model/Tree.py +++ b/federatedscope/vertical_fl/tree_based_models/model/Tree.py @@ -177,7 +177,8 @@ def cal_gain(self, split_idx, y, indicator): else: raise ValueError(f'Task type error: {self.task_type}') - def cal_gain_for_rf_label_base(self, node_num, split_idx, y, indicator): + def cal_gain_for_rf_label_scattering(self, node_num, split_idx, y, + indicator): y_left_children_label_sum = np.sum(y[:split_idx]) y_right_children_label_sum = np.sum(y[split_idx:]) left_children_num = np.sum(indicator[:split_idx]) diff --git a/federatedscope/vertical_fl/tree_based_models/trainer/label_protected_trainer.py b/federatedscope/vertical_fl/tree_based_models/trainer/label_protected_trainer.py index e55860af8..8afbb2d38 100644 --- a/federatedscope/vertical_fl/tree_based_models/trainer/label_protected_trainer.py +++ b/federatedscope/vertical_fl/tree_based_models/trainer/label_protected_trainer.py @@ -307,7 +307,7 @@ def get_best_gain_from_msg(self, msg, tree_num=None, node_num=None): continue gain = self.model[ - tree_num].cal_gain_for_rf_label_base( + tree_num].cal_gain_for_rf_label_scattering( node_num, value_idx, label, indicator) if gain < best_gain: client_has_max_gain = client_id diff --git a/tests/test_tree_based_model_for_vfl.py b/tests/test_tree_based_model_for_vfl.py index ebc7af011..16276c579 100644 --- a/tests/test_tree_based_model_for_vfl.py +++ b/tests/test_tree_based_model_for_vfl.py @@ -157,7 +157,7 @@ def set_config_for_rf_base(self, cfg): return backup_cfg - def set_config_for_rf_label_base(self, cfg): + def set_config_for_rf_label_scattering(self, cfg): backup_cfg = cfg.clone() import torch @@ -473,7 +473,7 @@ def test_RF_Base(self): def test_RF_lable_Base(self): init_cfg = global_cfg.clone() - backup_cfg = self.set_config_for_rf_label_base(init_cfg) + backup_cfg = self.set_config_for_rf_label_scattering(init_cfg) setup_seed(init_cfg.seed) update_logger(init_cfg, True) From 71ae52f303bb6402b155d42a141a1b24c966add9 Mon Sep 17 00:00:00 2001 From: qbc Date: Thu, 30 Mar 2023 20:57:52 +0800 Subject: [PATCH 3/7] minor changes --- federatedscope/vertical_fl/tree_based_models/model/Tree.py | 1 + 1 file changed, 1 insertion(+) diff --git a/federatedscope/vertical_fl/tree_based_models/model/Tree.py b/federatedscope/vertical_fl/tree_based_models/model/Tree.py index d0d78ce5b..46a505000 100644 --- a/federatedscope/vertical_fl/tree_based_models/model/Tree.py +++ b/federatedscope/vertical_fl/tree_based_models/model/Tree.py @@ -183,6 +183,7 @@ def cal_gain_for_rf_label_scattering(self, node_num, split_idx, y, y_right_children_label_sum = np.sum(y[split_idx:]) left_children_num = np.sum(indicator[:split_idx]) right_children_num = np.sum(indicator[split_idx:]) + if self.task_type == 'classification': if np.sum(indicator) == np.sum(y) or np.sum(y) == 0: return 0 From 2b4aba357dbb640e3a378e1d41c807fa113d5973 Mon Sep 17 00:00:00 2001 From: qbc Date: Thu, 30 Mar 2023 21:54:06 +0800 Subject: [PATCH 4/7] minor changes --- federatedscope/vertical_fl/tree_based_models/model/Tree.py | 1 + 1 file changed, 1 insertion(+) diff --git a/federatedscope/vertical_fl/tree_based_models/model/Tree.py b/federatedscope/vertical_fl/tree_based_models/model/Tree.py index 46a505000..37fb190fd 100644 --- a/federatedscope/vertical_fl/tree_based_models/model/Tree.py +++ b/federatedscope/vertical_fl/tree_based_models/model/Tree.py @@ -179,6 +179,7 @@ def cal_gain(self, split_idx, y, indicator): def cal_gain_for_rf_label_scattering(self, node_num, split_idx, y, indicator): + y_left_children_label_sum = np.sum(y[:split_idx]) y_right_children_label_sum = np.sum(y[split_idx:]) left_children_num = np.sum(indicator[:split_idx]) From dee4b178ab179cc29bd3bbdb29a5516dd62fa8ee Mon Sep 17 00:00:00 2001 From: qbc Date: Fri, 31 Mar 2023 10:44:15 +0800 Subject: [PATCH 5/7] add README for yaml files --- .../tree_based_models/baseline/README.md | 20 +++++++++++ .../rf_feature_gathering_on_abalone.yaml | 2 +- .../rf_feature_gathering_on_adult.yaml | 2 +- .../xgb_feature_gathering_on_blog.yaml | 35 ------------------- .../xgb_feature_gathering_on_credit.yaml | 35 ------------------- 5 files changed, 22 insertions(+), 72 deletions(-) create mode 100644 federatedscope/vertical_fl/tree_based_models/baseline/README.md delete mode 100644 federatedscope/vertical_fl/tree_based_models/baseline/xgb_feature_gathering_on_blog.yaml delete mode 100644 federatedscope/vertical_fl/tree_based_models/baseline/xgb_feature_gathering_on_credit.yaml diff --git a/federatedscope/vertical_fl/tree_based_models/baseline/README.md b/federatedscope/vertical_fl/tree_based_models/baseline/README.md new file mode 100644 index 000000000..072161282 --- /dev/null +++ b/federatedscope/vertical_fl/tree_based_models/baseline/README.md @@ -0,0 +1,20 @@ +Here we give some hand-on examples, and roughly show their characteristics. + +For more details, please see the specific configuration in each yaml files. + +| Yaml | Task | Algo | Protect_method | Eval_protection | +| --------------------------------------------------- | ----- | -------- | -------------- | --------------- | +| `gbdt_feature_gathering_on_abalone.yaml` | Reg. | `'gbdt'` | None | None | +| `gbdt_feature_gathering_on_adult.yaml` | Clas. | `'gbdt'` | None | None | +| `gbdt_label_scattering_on_adult.yaml` | Clas. | `'gbdt'` | `'he'` | None | +| `rf_feature_gathering_on_abalone.yaml` | Reg. | `'rf'` | None | None | +| `rf_feature_gathering_on_adult.yaml` | Clas. | `'rf'` | None | None | +| `rf_label_scattering_on_adult.yaml` | Clas. | `'rf'` | `'he'` | None | +| `xgb_feature_gathering_on_abalone.yaml` | Reg. | `'xgb'` | None | None | +| `xgb_feature_gathering_on_adult.yaml` | Clas. | `'xgb'` | None | None | +| `xgb_feature_gathering_dp_on_abalone.yaml` | Reg. | `'xgb'` | None | None | +| `xgb_feature_gathering_dp_on_adult.yaml` | Clas. | `'xgb'` | `'dp'` | None | +| `xgb_feature_gathering_op_boost_on_adult.yaml` | Clas. | `'xgb'` | `'op_boost'` | None | +| `xgb_label_scattering_on_abalone.yaml` | Reg. | `'xgb'` | `'he'` | None | +| `xgb_label_scattering_on_adult.yaml` | Clas. | `'xgb'` | `'he'` | None | +| `xgb_feature_gathering_dp_on_adult_by_he_eval.yaml` | Clas. | `'xgb'` | `'he'` | `'he'` | \ No newline at end of file diff --git a/federatedscope/vertical_fl/tree_based_models/baseline/rf_feature_gathering_on_abalone.yaml b/federatedscope/vertical_fl/tree_based_models/baseline/rf_feature_gathering_on_abalone.yaml index 2bd00081d..001bbb609 100644 --- a/federatedscope/vertical_fl/tree_based_models/baseline/rf_feature_gathering_on_abalone.yaml +++ b/federatedscope/vertical_fl/tree_based_models/baseline/rf_feature_gathering_on_abalone.yaml @@ -25,7 +25,7 @@ vertical: use: True dims: [4, 8] algo: 'rf' - data_size_for_debug: 1500 + data_size_for_debug: 2000 feature_subsample_ratio: 0.5 eval: freq: 3 diff --git a/federatedscope/vertical_fl/tree_based_models/baseline/rf_feature_gathering_on_adult.yaml b/federatedscope/vertical_fl/tree_based_models/baseline/rf_feature_gathering_on_adult.yaml index e8d176fa1..41eaca2ce 100644 --- a/federatedscope/vertical_fl/tree_based_models/baseline/rf_feature_gathering_on_adult.yaml +++ b/federatedscope/vertical_fl/tree_based_models/baseline/rf_feature_gathering_on_adult.yaml @@ -25,7 +25,7 @@ vertical: use: True dims: [7, 14] algo: 'rf' - data_size_for_debug: 1500 + data_size_for_debug: 2000 feature_subsample_ratio: 0.8 eval: freq: 3 diff --git a/federatedscope/vertical_fl/tree_based_models/baseline/xgb_feature_gathering_on_blog.yaml b/federatedscope/vertical_fl/tree_based_models/baseline/xgb_feature_gathering_on_blog.yaml deleted file mode 100644 index d8b43b042..000000000 --- a/federatedscope/vertical_fl/tree_based_models/baseline/xgb_feature_gathering_on_blog.yaml +++ /dev/null @@ -1,35 +0,0 @@ -use_gpu: False -device: 0 -backend: torch -federate: - mode: standalone - client_num: 2 -model: - type: xgb_tree - lambda_: 0.1 - gamma: 0 - num_of_trees: 10 - max_tree_depth: 3 -data: - root: data/ - type: blog - splits: [1.0, 0.0] -dataloader: - type: raw - batch_size: 8000 -criterion: - type: RegressionMSELoss -trainer: - type: verticaltrainer -train: - optimizer: - # learning rate for xgb model - eta: 1 -vertical: - use: True - dims: [10, 20] - algo: 'xgb' - data_size_for_debug: 2000 -eval: - freq: 3 - best_res_update_round_wise_key: test_loss \ No newline at end of file diff --git a/federatedscope/vertical_fl/tree_based_models/baseline/xgb_feature_gathering_on_credit.yaml b/federatedscope/vertical_fl/tree_based_models/baseline/xgb_feature_gathering_on_credit.yaml deleted file mode 100644 index c325125b5..000000000 --- a/federatedscope/vertical_fl/tree_based_models/baseline/xgb_feature_gathering_on_credit.yaml +++ /dev/null @@ -1,35 +0,0 @@ -use_gpu: False -device: 0 -backend: torch -federate: - mode: standalone - client_num: 2 -model: - type: xgb_tree - lambda_: 0.1 - gamma: 0 - num_of_trees: 10 - max_tree_depth: 3 -data: - root: data/ - type: credit - splits: [0.8, 0.2] -dataloader: - type: raw - batch_size: 2000 -criterion: - type: CrossEntropyLoss -trainer: - type: verticaltrainer -train: - optimizer: - # learning rate for xgb model - eta: 0.5 -vertical: - use: True - dims: [5, 10] - algo: 'xgb' - data_size_for_debug: 2000 -eval: - freq: 3 - best_res_update_round_wise_key: test_loss \ No newline at end of file From 250ca7159d94eefdc23f844147607c24130df9cb Mon Sep 17 00:00:00 2001 From: qbc Date: Fri, 31 Mar 2023 10:46:49 +0800 Subject: [PATCH 6/7] minor changes --- federatedscope/vertical_fl/tree_based_models/baseline/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/federatedscope/vertical_fl/tree_based_models/baseline/README.md b/federatedscope/vertical_fl/tree_based_models/baseline/README.md index 072161282..885fa8f34 100644 --- a/federatedscope/vertical_fl/tree_based_models/baseline/README.md +++ b/federatedscope/vertical_fl/tree_based_models/baseline/README.md @@ -1,6 +1,6 @@ Here we give some hand-on examples, and roughly show their characteristics. -For more details, please see the specific configuration in each yaml files. +For more details, please see the specific configuration in each file. | Yaml | Task | Algo | Protect_method | Eval_protection | | --------------------------------------------------- | ----- | -------- | -------------- | --------------- | From 50f2ebe017444f439e8796a7c834a4a55f8a268a Mon Sep 17 00:00:00 2001 From: qbc Date: Fri, 31 Mar 2023 14:08:15 +0800 Subject: [PATCH 7/7] add more columns in README --- .../tree_based_models/baseline/README.md | 32 +++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/federatedscope/vertical_fl/tree_based_models/baseline/README.md b/federatedscope/vertical_fl/tree_based_models/baseline/README.md index 885fa8f34..2433e44e6 100644 --- a/federatedscope/vertical_fl/tree_based_models/baseline/README.md +++ b/federatedscope/vertical_fl/tree_based_models/baseline/README.md @@ -2,19 +2,19 @@ Here we give some hand-on examples, and roughly show their characteristics. For more details, please see the specific configuration in each file. -| Yaml | Task | Algo | Protect_method | Eval_protection | -| --------------------------------------------------- | ----- | -------- | -------------- | --------------- | -| `gbdt_feature_gathering_on_abalone.yaml` | Reg. | `'gbdt'` | None | None | -| `gbdt_feature_gathering_on_adult.yaml` | Clas. | `'gbdt'` | None | None | -| `gbdt_label_scattering_on_adult.yaml` | Clas. | `'gbdt'` | `'he'` | None | -| `rf_feature_gathering_on_abalone.yaml` | Reg. | `'rf'` | None | None | -| `rf_feature_gathering_on_adult.yaml` | Clas. | `'rf'` | None | None | -| `rf_label_scattering_on_adult.yaml` | Clas. | `'rf'` | `'he'` | None | -| `xgb_feature_gathering_on_abalone.yaml` | Reg. | `'xgb'` | None | None | -| `xgb_feature_gathering_on_adult.yaml` | Clas. | `'xgb'` | None | None | -| `xgb_feature_gathering_dp_on_abalone.yaml` | Reg. | `'xgb'` | None | None | -| `xgb_feature_gathering_dp_on_adult.yaml` | Clas. | `'xgb'` | `'dp'` | None | -| `xgb_feature_gathering_op_boost_on_adult.yaml` | Clas. | `'xgb'` | `'op_boost'` | None | -| `xgb_label_scattering_on_abalone.yaml` | Reg. | `'xgb'` | `'he'` | None | -| `xgb_label_scattering_on_adult.yaml` | Clas. | `'xgb'` | `'he'` | None | -| `xgb_feature_gathering_dp_on_adult_by_he_eval.yaml` | Clas. | `'xgb'` | `'he'` | `'he'` | \ No newline at end of file +| Yaml | Dataset | Model _type | Algo | Protect_method | Eval_protection | +| --------------------------------------------------- | -------------- | --------------------- | -------- | -------------- | --------------- | +| `gbdt_feature_gathering_on_abalone.yaml` | Abalone (reg.) | `'feature_gathering'` | `'gbdt'` | None | None | +| `gbdt_feature_gathering_on_adult.yaml` | Adult (clas.) | `'feature_gathering'` | `'gbdt'` | None | None | +| `gbdt_label_scattering_on_adult.yaml` | Adult (clas.) | `'label_scattering'` | `'gbdt'` | `'he'` | None | +| `rf_feature_gathering_on_abalone.yaml` | Abalone (reg.) | `'feature_gathering'` | `'rf'` | None | None | +| `rf_feature_gathering_on_adult.yaml` | Adult (clas.) | `'feature_gathering'` | `'rf'` | None | None | +| `rf_label_scattering_on_adult.yaml` | Adult (clas.) | `'label_scattering'` | `'rf'` | `'he'` | None | +| `xgb_feature_gathering_on_abalone.yaml` | Abalone (reg.) | `'feature_gathering'` | `'xgb'` | None | None | +| `xgb_feature_gathering_on_adult.yaml` | Adult (clas.) | `'feature_gathering'` | `'xgb'` | None | None | +| `xgb_feature_gathering_dp_on_abalone.yaml` | Abalone (reg.) | `'feature_gathering'` | `'xgb'` | None | None | +| `xgb_feature_gathering_dp_on_adult.yaml` | Adult (clas.) | `'feature_gathering'` | `'xgb'` | `'dp'` | None | +| `xgb_feature_gathering_op_boost_on_adult.yaml` | Adult (clas.) | `'feature_gathering'` | `'xgb'` | `'op_boost'` | None | +| `xgb_label_scattering_on_abalone.yaml` | Abalone (reg.) | `'label_scattering'` | `'xgb'` | `'he'` | None | +| `xgb_label_scattering_on_adult.yaml` | Adult (clas.) | `'label_scattering'` | `'xgb'` | `'he'` | None | +| `xgb_feature_gathering_dp_on_adult_by_he_eval.yaml` | Adult (clas.) | `'feature_gathering'` | `'xgb'` | `'he'` | `'he'` | \ No newline at end of file