Skip to content

Commit f42274a

Browse files
authored
Merge branch 'main' into container-streaming
2 parents 688b813 + 4f48ed4 commit f42274a

14 files changed

+123
-350
lines changed

examples/advanced/kaplan-meier-he/README.md

+5-28
Original file line numberDiff line numberDiff line change
@@ -92,43 +92,20 @@ After these rounds, the federated work is completed. Then at each client, the ag
9292
## Run the job
9393
First, we prepared data for a 5-client federated job. We split and generate the data files for each client with binning interval of 7 days.
9494
```commandline
95-
python utils/prepare_data.py --site_num 5 --bin_days 7 --out_path "/tmp/flare/dataset/km_data"
95+
python utils/prepare_data.py --site_num 5 --bin_days 7 --out_path "/tmp/nvflare/dataset/km_data"
9696
```
9797

9898
Then we prepare HE context for clients and server, note that this step is done by secure provisioning for real-life applications, but in this study experimenting with BFV scheme, we use this step to distribute the HE context.
9999
```commandline
100-
python utils/prepare_he_context.py --out_path "/tmp/flare/he_context"
100+
python utils/prepare_he_context.py --out_path "/tmp/nvflare/he_context"
101101
```
102102

103-
Next, we set the location of the job templates directory.
103+
Next, we run the federated training using NVFlare Simulator via [JobAPI](https://nvflare.readthedocs.io/en/main/programming_guide/fed_job_api.html), both without and with HE:
104104
```commandline
105-
nvflare config -jt ./job_templates
105+
python km_job.py
106+
python km_job.py --encryption
106107
```
107108

108-
Then we can generate the job configurations from the `kaplan_meier` template:
109-
110-
Both for the federated job without HE:
111-
```commandline
112-
N_CLIENTS=5
113-
nvflare job create -force -j "/tmp/flare/jobs/kaplan-meier" -w "kaplan_meier" -sd "./src" \
114-
-f config_fed_client.conf app_script="kaplan_meier_train.py" app_config="--data_root /tmp/flare/dataset/km_data" \
115-
-f config_fed_server.conf min_clients=${N_CLIENTS}
116-
```
117-
and for the federated job with HE:
118-
```commandline
119-
N_CLIENTS=5
120-
nvflare job create -force -j "/tmp/flare/jobs/kaplan-meier-he" -w "kaplan_meier_he" -sd "./src" \
121-
-f config_fed_client.conf app_script="kaplan_meier_train_he.py" app_config="--data_root /tmp/flare/dataset/km_data --he_context_path /tmp/flare/he_context/he_context_client.txt" \
122-
-f config_fed_server.conf min_clients=${N_CLIENTS} he_context_path="/tmp/flare/he_context/he_context_server.txt"
123-
```
124-
125-
And we can run the federated job:
126-
```commandline
127-
nvflare simulator -w /tmp/flare/workspace_km -n 5 -t 5 /tmp/flare/jobs/kaplan-meier
128-
```
129-
```commandline
130-
nvflare simulator -w /tmp/flare/workspace_km_he -n 5 -t 5 /tmp/flare/jobs/kaplan-meier-he
131-
```
132109
By default, this will generate a KM curve image `km_curve_fl.png` and `km_curve_fl_he.png` under each client's directory.
133110

134111
## Display Result

examples/advanced/kaplan-meier-he/job_templates/kaplan_meier/config_fed_client.conf

-116
This file was deleted.

examples/advanced/kaplan-meier-he/job_templates/kaplan_meier/config_fed_server.conf

-19
This file was deleted.

examples/advanced/kaplan-meier-he/job_templates/kaplan_meier/info.conf

-5
This file was deleted.

examples/advanced/kaplan-meier-he/job_templates/kaplan_meier/info.md

-11
This file was deleted.

examples/advanced/kaplan-meier-he/job_templates/kaplan_meier/meta.conf

-8
This file was deleted.

examples/advanced/kaplan-meier-he/job_templates/kaplan_meier_he/config_fed_client.conf

-116
This file was deleted.

examples/advanced/kaplan-meier-he/job_templates/kaplan_meier_he/config_fed_server.conf

-20
This file was deleted.

examples/advanced/kaplan-meier-he/job_templates/kaplan_meier_he/info.conf

-5
This file was deleted.

examples/advanced/kaplan-meier-he/job_templates/kaplan_meier_he/info.md

-11
This file was deleted.

examples/advanced/kaplan-meier-he/job_templates/kaplan_meier_he/meta.conf

-8
This file was deleted.

0 commit comments

Comments
 (0)