From 57e377152828b1dcfc5a6fd1f1cf05392b64e470 Mon Sep 17 00:00:00 2001 From: Arun Patole Date: Fri, 30 Aug 2024 08:16:26 +0530 Subject: [PATCH] Fix hierarchical stats documentation This patch fixes few typos in the hierarchical stats documentation and fixes the prepare_data python script. --- .../advanced/federated-statistics/df_stats.ipynb | 2 +- .../hierarchical_stats/README.md | 4 ++-- .../hierarchical_stats/hierarchical_stats.ipynb | 4 ++-- .../hierarchical_stats/utils/prepare_data.py | 14 ++++++++++++++ .../federated-statistics/image_stats.ipynb | 2 +- 5 files changed, 20 insertions(+), 6 deletions(-) diff --git a/examples/advanced/federated-statistics/df_stats.ipynb b/examples/advanced/federated-statistics/df_stats.ipynb index 852d9cd6a5..93d3e86140 100644 --- a/examples/advanced/federated-statistics/df_stats.ipynb +++ b/examples/advanced/federated-statistics/df_stats.ipynb @@ -164,7 +164,7 @@ "source": [ "**Run Job using Simulator CLI**\n", "\n", - "From a **terminal** one can also the following equivallent CLI\n", + "From a **terminal** one can also the following equivalent CLI\n", "\n", "```\n", "nvflare simulator df_stats/jobs/df_stats -w /tmp/nvflare/df_stats -n 2 -t 2\n", diff --git a/examples/advanced/federated-statistics/hierarchical_stats/README.md b/examples/advanced/federated-statistics/hierarchical_stats/README.md index c4bc75feb8..87c6b8f31b 100644 --- a/examples/advanced/federated-statistics/hierarchical_stats/README.md +++ b/examples/advanced/federated-statistics/hierarchical_stats/README.md @@ -29,7 +29,7 @@ In this example, we are using synthetic anonymous students scores datasets gener Run the script `prepare_data.sh` that generates 7 different datasets each having random number of entries between 1000 to 2000. Each entry in the datasets has three columns - `Pass`, `Fail` and `Percentage`. `Pass`/`Fail` represents whether the particular student passed or failed the exam and `Percentage` represents the overall percentage marks scored by the student. ```shell -prepare_data.sh +./prepare_data.sh ``` it should show something like ``` @@ -53,7 +53,7 @@ With FL simulator, we can just run the example with CLI command ``` -cd NVFlare/examples/advanced/hierarchical_stats +cd NVFlare/examples/advanced/federated-statistics nvflare simulator hierarchical_stats/jobs/hierarchical_stats -w /tmp/nvflare/hierarchical_stats/ -n 7 -t 7 -c university-1,university-2,university-3,university-4,university-5,university-6,university-7 ``` diff --git a/examples/advanced/federated-statistics/hierarchical_stats/hierarchical_stats.ipynb b/examples/advanced/federated-statistics/hierarchical_stats/hierarchical_stats.ipynb index 0d25322219..c2abee5d0e 100644 --- a/examples/advanced/federated-statistics/hierarchical_stats/hierarchical_stats.ipynb +++ b/examples/advanced/federated-statistics/hierarchical_stats/hierarchical_stats.ipynb @@ -120,10 +120,10 @@ "source": [ "**Run Job using Simulator CLI**\n", "\n", - "From a **terminal** one can also the following equivallent CLI\n", + "From a **terminal** one can also the following equivalent CLI\n", "\n", "```\n", - "cd NVFlare/examples/advanced/hierarchical_stats\n", + "cd NVFlare/examples/advanced/federated-statistics\n", "nvflare simulator hierarchical_stats/jobs/hierarchical_stats -w /tmp/nvflare/hierarchical_stats/ -n 7 -t 7 -c university-1,university-2,university-3,university-4,university-5,university-6,university-7\n", "\n", "```\n", diff --git a/examples/advanced/federated-statistics/hierarchical_stats/utils/prepare_data.py b/examples/advanced/federated-statistics/hierarchical_stats/utils/prepare_data.py index 23f0298e46..aa05bf55c1 100644 --- a/examples/advanced/federated-statistics/hierarchical_stats/utils/prepare_data.py +++ b/examples/advanced/federated-statistics/hierarchical_stats/utils/prepare_data.py @@ -67,3 +67,17 @@ def prepare_data(): ) print("\nDone preparing data.") + + +def main(): + prog_name = "data_utils" + parser, args = parse_args(prog_name) + + if args.prepare_data: + prepare_data() + else: + parser.print_help() + + +if __name__ == "__main__": + main() diff --git a/examples/advanced/federated-statistics/image_stats.ipynb b/examples/advanced/federated-statistics/image_stats.ipynb index fe78e4e99c..ca895d9421 100644 --- a/examples/advanced/federated-statistics/image_stats.ipynb +++ b/examples/advanced/federated-statistics/image_stats.ipynb @@ -156,7 +156,7 @@ "source": [ "**Run Job using Simulator CLI**\n", "\n", - "From a **terminal** one can also the following equivallent CLI\n", + "From a **terminal** one can also the following equivalent CLI\n", "\n", "```\n", "nvflare simulator image_stats/jobs/image_stats -w /tmp/nvflare/workspace/image_stats -n 4 -t 4\n",