-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5305 from FederatedAI/dev-2.0.0-rc-sp3
dev 2.0.0 rc sp3
- Loading branch information
Showing
158 changed files
with
22,289 additions
and
1,590 deletions.
There are no files selected for viewing
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
communicator: | ||
verbose: False | ||
debug: | ||
debug_mode: False | ||
validation_mode: False | ||
encoder: | ||
precision_bits: 16 | ||
functions: | ||
max_method: "log_reduction" | ||
|
||
# exponential function | ||
exp_iterations: 8 | ||
|
||
# reciprocal configuration | ||
reciprocal_method: "NR" | ||
reciprocal_nr_iters: 10 | ||
reciprocal_log_iters: 1 | ||
reciprocal_all_pos: False | ||
reciprocal_initial: null | ||
|
||
# sqrt configuration | ||
sqrt_nr_iters: 3 | ||
sqrt_nr_initial: null | ||
|
||
# sigmoid / tanh configuration | ||
sigmoid_tanh_method: "reciprocal" | ||
sigmoid_tanh_terms: 32 | ||
|
||
# log configuration | ||
log_iterations: 2 | ||
log_exp_iterations: 8 | ||
log_order: 8 | ||
|
||
# trigonometry configuration | ||
trig_iterations: 10 | ||
|
||
# error function configuration: | ||
erf_iterations: 8 | ||
mpc: | ||
active_security: False | ||
provider: "TFP" | ||
protocol: "beaver" | ||
nn: | ||
dpsmpc: | ||
protocol: "layer_estimation" | ||
skip_loss_forward: True | ||
cache_pred_size: True |
38 changes: 38 additions & 0 deletions
38
examples/pipeline/feature_correlation/feature_correlation_testsuite.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
data: | ||
- file: examples/data/breast_hetero_guest.csv | ||
meta: | ||
delimiter: "," | ||
dtype: float64 | ||
input_format: dense | ||
label_type: int64 | ||
label_name: y | ||
match_id_name: id | ||
match_id_range: 0 | ||
tag_value_delimiter: ":" | ||
tag_with_value: false | ||
weight_type: float64 | ||
partitions: 4 | ||
head: true | ||
extend_sid: true | ||
table_name: breast_hetero_guest | ||
namespace: experiment | ||
role: guest_0 | ||
- file: examples/data/breast_hetero_host.csv | ||
meta: | ||
delimiter: "," | ||
dtype: float64 | ||
input_format: dense | ||
match_id_name: id | ||
match_id_range: 0 | ||
tag_value_delimiter: ":" | ||
tag_with_value: false | ||
weight_type: float64 | ||
partitions: 4 | ||
head: true | ||
extend_sid: true | ||
table_name: breast_hetero_host | ||
namespace: experiment | ||
role: host_0 | ||
tasks: | ||
feature-correlation: | ||
script: test_feature_correlation.py |
62 changes: 62 additions & 0 deletions
62
examples/pipeline/feature_correlation/test_feature_correlation.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
# | ||
# Copyright 2019 The FATE Authors. All Rights Reserved. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
import argparse | ||
|
||
from fate_client.pipeline import FateFlowPipeline | ||
from fate_client.pipeline.components.fate import PSI, FeatureCorrelation | ||
from fate_client.pipeline.interface import DataWarehouseChannel | ||
from fate_client.pipeline.utils import test_utils | ||
|
||
|
||
def main(config="../config.yaml", namespace=""): | ||
if isinstance(config, str): | ||
config = test_utils.load_job_config(config) | ||
parties = config.parties | ||
guest = parties.guest[0] | ||
host = parties.host[0] | ||
|
||
pipeline = FateFlowPipeline().set_parties(guest=guest, host=host) | ||
if config.task_cores: | ||
pipeline.conf.set("task_cores", config.task_cores) | ||
if config.timeout: | ||
pipeline.conf.set("timeout", config.timeout) | ||
|
||
psi_0 = PSI("psi_0") | ||
psi_0.guest.task_setting(input_data=DataWarehouseChannel(name="breast_hetero_guest", | ||
namespace=f"experiment{namespace}")) | ||
psi_0.hosts[0].task_setting(input_data=DataWarehouseChannel(name="breast_hetero_host", | ||
namespace=f"experiment{namespace}")) | ||
|
||
feature_corr_0 = FeatureCorrelation("feature_corr_0", | ||
input_data=psi_0.outputs["output_data"]) | ||
|
||
pipeline.add_task(psi_0) | ||
pipeline.add_task(feature_corr_0) | ||
|
||
pipeline.compile() | ||
print(pipeline.get_dag()) | ||
pipeline.fit() | ||
|
||
print(pipeline.get_task_info("feature_corr_0").get_output_model()) | ||
|
||
|
||
if __name__ == "__main__": | ||
parser = argparse.ArgumentParser("PIPELINE DEMO") | ||
parser.add_argument("--config", type=str, default="../config.yaml", | ||
help="config file") | ||
parser.add_argument("--namespace", type=str, default="", | ||
help="namespace for data stored in FATE") | ||
args = parser.parse_args() | ||
main(config=args.config, namespace=args.namespace) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
84 changes: 84 additions & 0 deletions
84
java/osx/osx-broker/src/main/java/org/fedai/osx/broker/eggroll/ErJobIO.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
/* | ||
* Copyright 2019 The FATE Authors. All Rights Reserved. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package org.fedai.osx.broker.eggroll; | ||
|
||
import com.webank.eggroll.core.meta.Meta; | ||
|
||
public class ErJobIO extends BaseProto<Meta.JobIO> { | ||
|
||
ErStore erStore; | ||
ErSerdes keySerdes; | ||
ErSerdes valueSerdes; | ||
ErPartitioner partitioner; | ||
|
||
public ErJobIO(ErStore erStore, ErSerdes keySerdes, ErSerdes valueSerdes, ErPartitioner partitioner) { | ||
this.erStore = erStore; | ||
this.keySerdes = keySerdes; | ||
this.valueSerdes = valueSerdes; | ||
this.partitioner = partitioner; | ||
} | ||
|
||
public static ErJobIO parseFromPb(Meta.JobIO jobIO) { | ||
ErStore erStore = ErStore.parseFromPb(jobIO.getStore()); | ||
ErSerdes key_serdes = ErSerdes.parseFromPb(jobIO.getKeySerdes()); | ||
ErSerdes value_serdes = ErSerdes.parseFromPb(jobIO.getValueSerdes()); | ||
ErPartitioner partitioner = ErPartitioner.parseFromPb(jobIO.getPartitioner()); | ||
ErJobIO erJobIO = new ErJobIO(erStore, key_serdes, value_serdes, partitioner); | ||
return erJobIO; | ||
} | ||
|
||
public ErSerdes getKeySerdes() { | ||
return keySerdes; | ||
} | ||
|
||
public void setKeySerdes(ErSerdes keySerdes) { | ||
this.keySerdes = keySerdes; | ||
} | ||
|
||
public ErSerdes getValueSerdes() { | ||
return valueSerdes; | ||
} | ||
|
||
public void setValueSerdes(ErSerdes valueSerdes) { | ||
this.valueSerdes = valueSerdes; | ||
} | ||
|
||
public ErPartitioner getPartitioner() { | ||
return partitioner; | ||
} | ||
|
||
public void setPartitioner(ErPartitioner partitioner) { | ||
this.partitioner = partitioner; | ||
} | ||
|
||
public ErStore getErStore() { | ||
return erStore; | ||
} | ||
|
||
public void setErStore(ErStore erStore) { | ||
this.erStore = erStore; | ||
} | ||
|
||
@Override | ||
Meta.JobIO toProto() { | ||
Meta.JobIO.Builder builder = Meta.JobIO.newBuilder(); | ||
builder.setStore(erStore.toProto()) | ||
.setKeySerdes(keySerdes.toProto()) | ||
.setValueSerdes(valueSerdes.toProto()) | ||
.setPartitioner(partitioner.toProto()); | ||
return builder.build(); | ||
} | ||
} |
65 changes: 65 additions & 0 deletions
65
java/osx/osx-broker/src/main/java/org/fedai/osx/broker/eggroll/ErPartitioner.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
/* | ||
* Copyright 2019 The FATE Authors. All Rights Reserved. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package org.fedai.osx.broker.eggroll; | ||
|
||
import com.google.protobuf.ByteString; | ||
import com.webank.eggroll.core.meta.Meta; | ||
|
||
public class ErPartitioner extends BaseProto<Meta.Partitioner> { | ||
|
||
Integer t; | ||
ByteString body; | ||
|
||
public ErPartitioner(int t, ByteString body) { | ||
this.t = t; | ||
this.body = body; | ||
} | ||
|
||
public ErPartitioner(int t) { | ||
this(t, ByteString.EMPTY); | ||
} | ||
|
||
public static ErPartitioner parseFromPb(Meta.Partitioner partitioner) { | ||
int t = partitioner.getType(); | ||
ByteString body = partitioner.getBody(); | ||
return new ErPartitioner(t, body); | ||
} | ||
|
||
public int getT() { | ||
return t; | ||
} | ||
|
||
public void setT(Integer t) { | ||
this.t = t; | ||
} | ||
|
||
public ByteString getBody() { | ||
return body; | ||
} | ||
|
||
public void setBody(ByteString body) { | ||
this.body = body; | ||
} | ||
|
||
|
||
@Override | ||
Meta.Partitioner toProto() { | ||
Meta.Partitioner.Builder builder = Meta.Partitioner.newBuilder() | ||
.setType(this.t) | ||
.setBody(this.body); | ||
return builder.build(); | ||
} | ||
} |
Oops, something went wrong.