Skip to content

Commit

Permalink
edit doc
Browse files Browse the repository at this point in the history
edit examples

Signed-off-by: Yu Wu <yolandawu131@gmail.com>
  • Loading branch information
nemirorox committed Dec 27, 2023
1 parent efcc5bc commit e11cdd9
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 13 deletions.
8 changes: 6 additions & 2 deletions doc/2.0/fate/ml/run_launchers.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions examples/benchmark_performance/coordinated_lr/test_lr.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'])
Expand Down
12 changes: 5 additions & 7 deletions examples/benchmark_performance/hetero_secureboost/test_sbt.py
Original file line number Diff line number Diff line change
Expand Up @@ -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=""):
Expand Down Expand Up @@ -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()
Expand Down
4 changes: 2 additions & 2 deletions examples/benchmark_performance/sshe_lr/test_lr.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'])
Expand Down

0 comments on commit e11cdd9

Please sign in to comment.