From e11cdd9f876a3d7f0ed84d4ddce010046ccf3569 Mon Sep 17 00:00:00 2001 From: Yu Wu Date: Wed, 27 Dec 2023 18:11:52 +0800 Subject: [PATCH] edit doc edit examples Signed-off-by: Yu Wu --- doc/2.0/fate/ml/run_launchers.md | 8 ++++++-- .../benchmark_performance/coordinated_lr/test_lr.py | 4 ++-- .../hetero_secureboost/test_sbt.py | 12 +++++------- examples/benchmark_performance/sshe_lr/test_lr.py | 4 ++-- 4 files changed, 15 insertions(+), 13 deletions(-) diff --git a/doc/2.0/fate/ml/run_launchers.md b/doc/2.0/fate/ml/run_launchers.md index 0b24fc2164..72f57f13a0 100644 --- a/doc/2.0/fate/ml/run_launchers.md +++ b/doc/2.0/fate/ml/run_launchers.md @@ -19,7 +19,8 @@ Currently, we provide various ready-to-use launchers for testing mpc protocol an modules [here](../../../../launchers). To write a launcher, first come up with the case to be run with a FATE-module(as in FATE/python/fate/ml) and wrap this -case into a function. As a demo, we are to analyze a simple [launcher](../../../../launchers/sshe_lr_launcher.py) that +case into a function. As a demo, we are to +analyze [a simple launcher](https://raw.githubusercontent.com/FederatedAI/FATE/main/launchers/sshe_lr_launcher.py) that trains a SSHE Logistic Regression model using given local data files. We will use `breast` data set in this demo. Use the following command to download the original data files: @@ -138,9 +139,12 @@ if __name__ == "__main__": launch(run_sshe_lr, extra_args_desc=[SSHEArguments]) ``` +The complete launcher demo may be +downloaded [here](https://raw.githubusercontent.com/FederatedAI/FATE/main/launchers/sshe_lr_launcher.py). + ### Running A Launcher -As a demo, here we show how to run this Pearson launcher with the following setting from terminal: +As a demo, here we show how to run this SSHE LR launcher with the following setting from terminal: - guest: 9999 - host: 10000 diff --git a/examples/benchmark_performance/coordinated_lr/test_lr.py b/examples/benchmark_performance/coordinated_lr/test_lr.py index 1d17724e77..6e0530dc12 100644 --- a/examples/benchmark_performance/coordinated_lr/test_lr.py +++ b/examples/benchmark_performance/coordinated_lr/test_lr.py @@ -43,9 +43,9 @@ def main(config="../../config.yaml", param="./lr_config.yaml", namespace=""): host_train_data = {"name": host_data_table, "namespace": f"experiment{namespace}"} pipeline = FateFlowPipeline().set_parties(guest=guest, host=host, arbiter=arbiter) if config.task_cores: - pipeline.conf.set("task_cores", config.task_cores) + pipeline.conf.set("task", dict(engine_run={"cores": config.task_cores})) if config.timeout: - pipeline.conf.set("timeout", config.timeout) + pipeline.conf.set("task", dict(timeout=config.timeout)) reader_0 = Reader("reader_0", runtime_parties=dict(guest=guest, host=host)) reader_0.guest.task_parameters(namespace=guest_train_data['namespace'], name=guest_train_data['name']) diff --git a/examples/benchmark_performance/hetero_secureboost/test_sbt.py b/examples/benchmark_performance/hetero_secureboost/test_sbt.py index b8bcb7ab2c..b7714bd129 100644 --- a/examples/benchmark_performance/hetero_secureboost/test_sbt.py +++ b/examples/benchmark_performance/hetero_secureboost/test_sbt.py @@ -15,15 +15,13 @@ # import argparse -from fate_test.utils import parse_summary_result + from fate_client.pipeline import FateFlowPipeline -from fate_client.pipeline.components.fate import Evaluation -from fate_client.pipeline.interface import DataWarehouseChannel -from fate_client.pipeline.utils import test_utils from fate_client.pipeline.components.fate import HeteroSecureBoost, PSI from fate_client.pipeline.components.fate.evaluation import Evaluation -from fate_client.pipeline import FateFlowPipeline from fate_client.pipeline.interface import DataWarehouseChannel +from fate_client.pipeline.utils import test_utils +from fate_test.utils import parse_summary_result def main(config="../../config.yaml", param="./sbt_breast_config.yaml", namespace=""): @@ -90,9 +88,9 @@ def main(config="../../config.yaml", param="./sbt_breast_config.yaml", namespace pipeline.add_task(evaluation_0) if config.task_cores: - pipeline.conf.set("task_cores", config.task_cores) + pipeline.conf.set("task", dict(engine_run={"cores": config.task_cores})) if config.timeout: - pipeline.conf.set("timeout", config.timeout) + pipeline.conf.set("task", dict(timeout=config.timeout)) pipeline.compile() pipeline.fit() diff --git a/examples/benchmark_performance/sshe_lr/test_lr.py b/examples/benchmark_performance/sshe_lr/test_lr.py index 6a359928b0..dfd548f1a4 100644 --- a/examples/benchmark_performance/sshe_lr/test_lr.py +++ b/examples/benchmark_performance/sshe_lr/test_lr.py @@ -43,9 +43,9 @@ def main(config="../../config.yaml", param="./lr_config.yaml", namespace=""): host_train_data = {"name": host_data_table, "namespace": f"experiment{namespace}"} pipeline = FateFlowPipeline().set_parties(guest=guest, host=host, arbiter=arbiter) if config.task_cores: - pipeline.conf.set("task_cores", config.task_cores) + pipeline.conf.set("task", dict(engine_run={"cores": config.task_cores})) if config.timeout: - pipeline.conf.set("timeout", config.timeout) + pipeline.conf.set("task", dict(timeout=config.timeout)) reader_0 = Reader("reader_0", runtime_parties=dict(guest=guest, host=host)) reader_0.guest.task_parameters(namespace=guest_train_data['namespace'], name=guest_train_data['name'])