Skip to content

Commit c557b2f

Browse files
committed
fix LR ovr predict(FederatedAI#4659)
fix fate-test data cli(FederatedAI#5008) edit bq examples & add pipeline testsuite(FederatedAI#5008) Signed-off-by: Yu Wu <yolandawu131@gmail.com>
1 parent 2db064d commit c557b2f

File tree

57 files changed

+3559
-706
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+3559
-706
lines changed

doc/api/fate_test.md

+916
Large diffs are not rendered by default.

doc/tutorial/fate_test_tutorial.md

+91
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
# FATE Test Tutorial
2+
3+
A collection of useful tools to running FATE tests and [:file_folder:examples](../../examples).
4+
5+
## quick start
6+
7+
1. install
8+
9+
```bash
10+
pip install -e python/fate_test
11+
```
12+
2. edit default fate\_test\_config.yaml
13+
14+
```bash
15+
# edit priority config file with system default editor
16+
# filling some field according to comments
17+
fate_test config edit
18+
```
19+
20+
3. configure FATE-Flow Commandline server setting
21+
22+
```bash
23+
# configure FATE-Flow Commandline server setting
24+
flow init --port 9380 --ip 127.0.0.1
25+
```
26+
27+
4. run some fate\_test suite
28+
29+
```bash
30+
fate_test suite -i <path contains *testsuite.yaml>
31+
```
32+
33+
5. run some fate\_test benchmark quality
34+
35+
```bash
36+
fate_test benchmark-quality -i <path contains *benchmark.yaml>
37+
```
38+
39+
6. run some fate\_test benchmark performance
40+
41+
```bash
42+
fate_test benchmark-quality -i <path contains *performance.yaml>
43+
```
44+
45+
7useful logs or exception will be saved to logs dir with namespace
46+
shown in last step
47+
48+
## command types
49+
50+
- [suite](../api/fate_test.md#testsuite): used for running [testsuites](../api/fate_test.md#testsuite-configuration),
51+
collection of FATE jobs
52+
53+
```bash
54+
fate_test suite -i <path contains *testsuite.yaml>
55+
```
56+
57+
- [data](../api/fate_test.md#data): used for upload, delete, and generate dataset
58+
59+
- [upload/delete data](../api/fate_test.md#data-command-options) command:
60+
61+
```bash
62+
fate_test data [upload|delete] -i <path1 contains *testsuite.yaml | *benchmark.yaml>
63+
```
64+
- [upload example data of min_test/all_examples](../api/fate_test.md#data-command-options) command:
65+
66+
```bash
67+
fate_test data upload -t min_test
68+
fate_test data upload -t all_examples
69+
```
70+
71+
- [generate data](../api/fate_test.md#generate-command-options) command:
72+
73+
```bash
74+
fate_test data generate -i <path1 contains *testsuite.yaml | *benchmark.yaml>
75+
```
76+
77+
- [benchmark-quality](../api/fate_test.md#benchmark-quality): used for comparing modeling quality between FATE
78+
and other machine learning systems, as specified
79+
in [benchmark job configuration](../api/fate_test.md#benchmark-job-configuration)
80+
81+
```bash
82+
fate_test bq -i <path contains *benchmark.yaml>
83+
```
84+
85+
- [benchmark-performance](../api/fate_test.md#benchmark-performance): used for checking FATE algorithm performance; user
86+
should first generate and upload data before running performance testsuite
87+
88+
```bash
89+
fate_test data generate -i <path contains *performance.yaml> -ng 10000 -fg 10 -fh 10 -m 1.0 --upload-data
90+
fate_test performance -i <path contains *performance.yaml> --skip-data
91+
```

examples/benchmark_performance/coordinated_lr/test_lr_sid.py

+9-9
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
import argparse
1818

1919
from fate_client.pipeline import FateFlowPipeline
20-
from fate_client.pipeline.components.fate import CoordinatedLR, Intersection
20+
from fate_client.pipeline.components.fate import CoordinatedLR, PSI
2121
from fate_client.pipeline.components.fate import Evaluation
2222
from fate_client.pipeline.interface import DataWarehouseChannel
2323
from fate_client.pipeline.utils import test_utils
@@ -48,11 +48,11 @@ def main(config="../../config.yaml", param="./lr_config.yaml", namespace=""):
4848
if config.timeout:
4949
pipeline.conf.set("timeout", config.timeout)
5050

51-
intersect_0 = Intersection("intersect_0", method="raw")
52-
intersect_0.guest.component_setting(input_data=DataWarehouseChannel(name=guest_train_data["name"],
53-
namespace=guest_train_data["namespace"]))
54-
intersect_0.hosts[0].component_setting(input_data=DataWarehouseChannel(name=host_train_data["name"],
55-
namespace=host_train_data["namespace"]))
51+
psi_0 = PSI("psi_0")
52+
psi_0.guest.component_setting(input_data=DataWarehouseChannel(name=guest_train_data["name"],
53+
namespace=guest_train_data["namespace"]))
54+
psi_0.hosts[0].component_setting(input_data=DataWarehouseChannel(name=host_train_data["name"],
55+
namespace=host_train_data["namespace"]))
5656

5757
lr_param = {
5858
}
@@ -68,10 +68,10 @@ def main(config="../../config.yaml", param="./lr_config.yaml", namespace=""):
6868
}
6969
lr_param.update(config_param)
7070
lr_0 = CoordinatedLR("lr_0",
71-
train_data=intersect_0.outputs["output_data"],
71+
train_data=psi_0.outputs["output_data"],
7272
**lr_param)
7373
lr_1 = CoordinatedLR("lr_1",
74-
test_data=intersect_0.outputs["output_data"],
74+
test_data=psi_0.outputs["output_data"],
7575
input_model=lr_0.outputs["output_model"])
7676

7777
evaluation_0 = Evaluation("evaluation_0",
@@ -80,7 +80,7 @@ def main(config="../../config.yaml", param="./lr_config.yaml", namespace=""):
8080
metrics=["auc", "binary_precision", "binary_accuracy", "binary_recall"],
8181
input_data=lr_0.outputs["train_output_data"])
8282

83-
pipeline.add_task(intersect_0)
83+
pipeline.add_task(psi_0)
8484
pipeline.add_task(lr_0)
8585
pipeline.add_task(lr_1)
8686
pipeline.add_task(evaluation_0)

examples/benchmark_quality/lr/default_credit_config.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ data_guest: "default_credit_hetero_guest"
22
data_host: "default_credit_hetero_host"
33
idx: "id"
44
label_name: "y"
5-
epochs: 22
5+
epochs: 30
66
init_param:
77
fit_intercept: True
88
method: "zeros"
@@ -17,6 +17,6 @@ optimizer:
1717
penalty: "L2"
1818
alpha: 0.001
1919
optimizer_params:
20-
lr: 0.15
20+
lr: 0.21
2121
batch_size: 3200
2222
early_stop: "diff"

examples/benchmark_quality/lr/epsilon_5k_config.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ data_host: "epsilon_5k_hetero_host"
33
idx: "id"
44
label_name: "y"
55
epochs: 8
6-
batch_size: 2500
6+
batch_size: 2200
77
init_param:
88
fit_intercept: True
99
method: "random"

examples/benchmark_quality/lr/give_credit_config.yaml

+5-5
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,20 @@ data_guest: "give_credit_hetero_guest"
22
data_host: "give_credit_hetero_host"
33
idx: "id"
44
label_name: "y"
5-
epochs: 6
5+
epochs: 12
66
init_param:
77
fit_intercept: True
88
method: "zeros"
99
learning_rate_scheduler:
1010
method: "linear"
1111
scheduler_params:
12-
factor: 0.7
12+
start_factor: 0.71
1313
total_iters: 1000
1414
optimizer:
15-
method: "adam"
15+
method: "rmsprop"
1616
penalty: "L2"
17-
alpha: 10
17+
alpha: 0.01
1818
optimizer_params:
19-
lr: 0.2
19+
lr: 0.29
2020
batch_size: 5500
2121
early_stop: "diff"

examples/benchmark_quality/lr/lr_benchmark.yaml

+18-18
Original file line numberDiff line numberDiff line change
@@ -179,15 +179,15 @@ data:
179179
table_name: vehicle_scale_hetero_host
180180
namespace: experiment
181181
role: host_0
182-
hetero_lr-binary-0-breast:
183-
local:
184-
script: "./sklearn-lr-binary.py"
185-
conf: "./breast_lr_sklearn_config.yaml"
186-
FATE-hetero-lr:
187-
script: "./pipeline-lr-binary.py"
188-
conf: "./breast_config.yaml"
189-
compare_setting:
190-
relative_tol: 0.01
182+
#hetero_lr-binary-0-breast:
183+
# local:
184+
# script: "./sklearn-lr-binary.py"
185+
# conf: "./breast_lr_sklearn_config.yaml"
186+
# FATE-hetero-lr:
187+
# script: "./pipeline-lr-binary.py"
188+
# conf: "./breast_config.yaml"
189+
# compare_setting:
190+
# relative_tol: 0.01
191191
hetero_lr-binary-1-default-credit:
192192
local:
193193
script: "./sklearn-lr-binary.py"
@@ -197,15 +197,15 @@ hetero_lr-binary-1-default-credit:
197197
conf: "./default_credit_config.yaml"
198198
compare_setting:
199199
relative_tol: 0.01
200-
hetero_lr-binary-2-epsilon-5k:
201-
local:
202-
script: "./sklearn-lr-binary.py"
203-
conf: "./epsilon_5k_lr_sklearn_config.yaml"
204-
FATE-hetero-lr:
205-
script: "./pipeline-lr-binary.py"
206-
conf: "./epsilon_5k_config.yaml"
207-
compare_setting:
208-
relative_tol: 0.01
200+
#hetero_lr-binary-2-epsilon-5k:
201+
# local:
202+
# script: "./sklearn-lr-binary.py"
203+
# conf: "./epsilon_5k_lr_sklearn_config.yaml"
204+
# FATE-hetero-lr:
205+
# script: "./pipeline-lr-binary.py"
206+
# conf: "./epsilon_5k_config.yaml"
207+
# compare_setting:
208+
# relative_tol: 0.01
209209
hetero_lr-binary-3-give-credit:
210210
local:
211211
script: "./sklearn-lr-binary.py"

examples/benchmark_quality/lr/pipeline-lr-multi.py

+1
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ def main(config="../../config.yaml", param="./vehicle_config.yaml", namespace=""
7171
input_model=lr_0.outputs["output_model"])
7272

7373
evaluation_0 = Evaluation('evaluation_0',
74+
input_data=lr_0.outputs["train_output_data"],
7475
metrics=['multi_recall', 'multi_accuracy', 'multi_precision'])
7576
pipeline.add_task(psi_0)
7677
pipeline.add_task(lr_0)

examples/benchmark_quality/lr/sklearn-lr-multi.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,10 @@ def main(config="../../config.yaml", param="./vehicle_lr_sklearn_config.yaml"):
4242

4343
config_param = {
4444
"penalty": param["penalty"],
45-
"max_iter": param["max_iter"],
45+
"max_iter": param["epochs"],
4646
"alpha": param["alpha"],
4747
"learning_rate": "optimal",
48-
"eta0": param["learning_rate"],
48+
"eta0": param["eta0"],
4949
"random_state": 105
5050
}
5151

File renamed without changes.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
data:
2+
- file: examples/data/motor_hetero_guest.csv
3+
meta:
4+
delimiter: ","
5+
dtype: float64
6+
input_format: dense
7+
label_type: int64
8+
label_name: motor_speed
9+
match_id_name: id
10+
match_id_range: 0
11+
tag_value_delimiter: ":"
12+
tag_with_value: false
13+
weight_type: float64
14+
partitions: 4
15+
head: true
16+
extend_sid: true
17+
table_name: motor_hetero_guest
18+
namespace: experiment
19+
role: guest_0
20+
- file: examples/data/motor_hetero_host.csv
21+
meta:
22+
delimiter: ","
23+
dtype: float64
24+
input_format: dense
25+
match_id_name: id
26+
match_id_range: 0
27+
tag_value_delimiter: ":"
28+
tag_with_value: false
29+
weight_type: float64
30+
partitions: 4
31+
head: true
32+
extend_sid: true
33+
table_name: motor_hetero_host
34+
namespace: experiment
35+
role: host_0
36+
- file: examples/data/motor_hetero_host.csv
37+
meta:
38+
delimiter: ","
39+
dtype: float64
40+
input_format: dense
41+
match_id_name: id
42+
match_id_range: 0
43+
tag_value_delimiter: ":"
44+
tag_with_value: false
45+
weight_type: float64
46+
partitions: 4
47+
head: true
48+
extend_sid: true
49+
table_name: motor_hetero_host
50+
namespace: experiment
51+
role: host_1
52+
tasks:
53+
normal-linr:
54+
script: test_linr.py
55+
linr-cv:
56+
script: test_linr_cv.py
57+
linr-warm-start:
58+
script: test_linr_warm_start.py
59+
linr-multi-host:
60+
script: test_linr_multi_host.py

0 commit comments

Comments
 (0)