Skip to content

Commit

Permalink
edit examples(#4659)
Browse files Browse the repository at this point in the history
Signed-off-by: Yu Wu <yolandawu131@gmail.com>
  • Loading branch information
nemirorox committed Jul 12, 2023
1 parent 37a0809 commit e39746c
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 13 deletions.
24 changes: 13 additions & 11 deletions examples/pipeline/test_lr_sid.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,18 @@
pipeline = FateFlowPipeline().set_roles(guest="9999", host="9998", arbiter="9998")

intersect_0 = Intersection("intersect_0", method="raw")
intersect_0.guest.component_setting(input_data=DataWarehouseChannel(name="breast_hetero_guest_sid",
namespace="experiment"))
intersect_0.hosts[0].component_setting(input_data=DataWarehouseChannel(name="breast_hetero_host_sid",
namespace="experiment"))
intersect_0.guest.component_setting(input_data=DataWarehouseChannel(name="breast_hetero_guest",
namespace="experiment_sid"))
intersect_0.hosts[0].component_setting(input_data=DataWarehouseChannel(name="breast_hetero_host",
namespace="experiment_sid"))
lr_0 = CoordinatedLR("lr_0",
epochs=10,
epochs=2,
batch_size=100,
optimizer={"method": "sgd", "optimizer_params": {"lr": 0.01}, "alpha": 0.5},
optimizer={"method": "sgd", "optimizer_params": {"lr": 0.01}},
init_param={"fit_intercept": True},
train_data=intersect_0.outputs["output_data"])
lr_1 = CoordinatedLR("lr_1", test_data=intersect_0.outputs["output_data"],
input_model=lr_0.outputs["output_model"])

"""lr_0.guest.component_setting(train_data=DataWarehouseChannel(name="breast_hetero_guest_sid",
namespace="experiment"))
Expand All @@ -56,15 +58,15 @@
print(f"evaluation metrics: ")
print(pipeline.get_task_info("evaluation_0").get_output_metrics())

pipeline.deploy([lr_0])
pipeline.deploy([intersect_0, lr_0])

predict_pipeline = FateFlowPipeline()

deployed_pipeline = pipeline.get_deployed_pipeline()
lr_0.guest.component_setting(test_data=DataWarehouseChannel(name="breast_hetero_guest_sid",
namespace="experiment"))
lr_0.hosts[0].component_setting(test_data=DataWarehouseChannel(name="breast_hetero_host_sid",
namespace="experiment"))
deployed_pipeline.intersect_0.guest.component_setting(input_data=DataWarehouseChannel(name="breast_hetero_guest",
namespace="experiment_sid"))
deployed_pipeline.intersect_0.hosts[0].component_setting(input_data=DataWarehouseChannel(name="breast_hetero_host",
namespace="experiment_sid"))

predict_pipeline.add_task(deployed_pipeline)
predict_pipeline.compile()
Expand Down
4 changes: 2 additions & 2 deletions examples/pipeline/test_single_linr.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
input_model=feature_scale_0.outputs["output_model"])"""

linr_0 = CoordinatedLinR("linr_0",
max_iter=10,
epochs=10,
batch_size=-1,
init_param={"fit_intercept": False})

Expand All @@ -38,7 +38,7 @@
namespace="experiment"))

evaluation_0 = Evaluation("evaluation_0",
runtime_roles="guest",
runtime_roles=["guest"],
input_data=linr_0.outputs["train_output_data"])

# pipeline.add_task(feature_scale_0)
Expand Down

0 comments on commit e39746c

Please sign in to comment.