Skip to content

Commit b5ec419

Browse files
authored
Update XGBoost examples (#2066)
* Update xgboost examples * Change xgb params to match horizontal * Add job cli command for gpu support
1 parent 9ca4e4f commit b5ec419

File tree

24 files changed

+205
-159
lines changed

24 files changed

+205
-159
lines changed

examples/advanced/vertical_xgboost/README.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,11 @@ Since not every site will have the same set of data samples (rows), we can use P
3232

3333
> **_NOTE:_** The uid can be a composition of multiple variabes with a transformation, however in this example we use indices for simplicity. PSI can also be used for computing the intersection of overlapping features, but here we give each site unique features.
3434
35+
Create the psi job using the predefined psi_csv template:
36+
```
37+
nvflare job create -j ./jobs/vertical_xgb_psi -w psi_csv -sd ./code/psi -force
38+
```
39+
3540
Run the psi job to calculate the dataset intersection of the clients at `psi/intersection.txt` inside the psi workspace:
3641
```
3742
nvflare simulator ./jobs/vertical_xgb_psi -w /tmp/nvflare/vertical_xgb_psi -n 2 -t 2
@@ -55,7 +60,21 @@ By default, CPU based training is used.
5560
In order to enable GPU accelerated training, first ensure that your machine has CUDA installed and has at least one GPU.
5661
In `config_fed_client.json` set `"use_gpus": true` and `"tree_method": "hist"` in `xgb_params`. Then, in `FedXGBHistogramExecutor` we use the `device` parameter to map each rank to a GPU device ordinal in `xgb_params`. If using multiple GPUs, we can map each rank to a different GPU device, however you can also map each rank to the same GPU device if using a single GPU.
5762

63+
We can create a GPU enabled job using the job CLI:
64+
```
65+
nvflare job create -j ./jobs/vertical_xgb_gpu -w vertical_xgb \
66+
-f config_fed_client.conf use_gpus=true tree_method=hist \
67+
-f config_fed_server.conf \
68+
-sd ./code/vertical_xgb \
69+
-force
70+
```
71+
5872
## Run the Example
73+
Create the vertical xgboost job using the predefined vertical_xgb template:
74+
```
75+
nvflare job create -j ./jobs/vertical_xgb -w vertical_xgb -sd ./code/vertical_xgb -force
76+
```
77+
5978
Run the vertical xgboost job:
6079
```
6180
nvflare simulator ./jobs/vertical_xgb -w /tmp/nvflare/vertical_xgb -n 2 -t 2

examples/advanced/vertical_xgboost/jobs/vertical_xgb/app/config/config_fed_client.json

Lines changed: 0 additions & 45 deletions
This file was deleted.

examples/advanced/vertical_xgboost/jobs/vertical_xgb/app/config/config_fed_server.json

Lines changed: 0 additions & 18 deletions
This file was deleted.

examples/advanced/vertical_xgboost/jobs/vertical_xgb/meta.json

Lines changed: 0 additions & 10 deletions
This file was deleted.

examples/advanced/vertical_xgboost/jobs/vertical_xgb_psi/app/config/config_fed_client.json

Lines changed: 0 additions & 42 deletions
This file was deleted.

examples/advanced/vertical_xgboost/jobs/vertical_xgb_psi/app/config/config_fed_server.json

Lines changed: 0 additions & 12 deletions
This file was deleted.

examples/advanced/vertical_xgboost/jobs/vertical_xgb_psi/meta.json

Lines changed: 0 additions & 10 deletions
This file was deleted.

examples/advanced/vertical_xgboost/requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ openmined.psi==1.1.1
33
pandas
44
tensorboard
55
torch
6-
xgboost>=1.7.0
6+
xgboost>=2.0.0

0 commit comments

Comments
 (0)