Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

doc update #5416

Merged
merged 1 commit into from
Dec 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ FATE is an open source project hosted by Linux Foundation. The [Technical Charte
### Version < 2.0
Releases history can be found in [releases](https://github.com/FederatedAI/FATE/releases), deployment resources can be found on [wiki](https://github.com/FederatedAI/FATE/wiki/Download)

### Version == 2.0.0-beta
### Version == 2.0.0
#### Standalone deployment
- Deploying FATE on a single node via PyPI, pre-built docker images or installers. It is for simple testing purposes. Refer to this [guide](./deploy/standalone-deploy/).

Expand All @@ -35,7 +35,7 @@ Deploying FATE to multiple nodes to achieve scalability, reliability and managea
- [Cluster deployment by CLI](./deploy/cluster-deploy): Using CLI to deploy a FATE cluster.

### Quick Start
- [Training Demo With Installing FATE AND FATE-Flow From Pypi](doc/2.0/quick_start.md)
- [Training Demo With Installing FATE AND FATE-Flow From Pypi](doc/2.0/fate/quick_start.md)
- [Training Demo With Installing FATE Only From Pypi](doc/2.0/fate/ml)

## Related Repositories (Projects)
Expand Down
4 changes: 2 additions & 2 deletions README_zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@ FATE于2019年2月首次对外开源,并成立
### 2.0以前的版本
FATE 2.0以前的版本在[发布页](https://github.com/FederatedAI/FATE/releases), 下载资源汇总页在[wiki](https://github.com/FederatedAI/FATE/wiki/Download)

### 2.0.0-beta 版本
### 2.0.0 版本
#### 单机版部署
在单节点上部署FATE单机版,支持从 PyPI 直接安装,docker,主机安装包三种方式。
- [单机版部署教程](./deploy/standalone-deploy)
#### 集群
- [原生集群安装](./deploy/cluster-deploy): Using CLI to deploy a FATE cluster.

### 快速开始
- [从 PyPI 下载安装 FATE 和 FATE-Flow 并启动训练任务示例](doc/2.0/quick_start.md)
- [从 PyPI 下载安装 FATE 和 FATE-Flow 并启动训练任务示例](doc/2.0/fate/quick_start.md)
- [从 PyPI 下载安装 FATE,并启动训练任务示例](doc/2.0/fate/ml)

## 关联仓库
Expand Down
2 changes: 1 addition & 1 deletion doc/2.0/fate/components/linear_regression.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Here we simplify participants of the federation process into three
parties. Party A represents Guest, party B represents Host. Party C,
which is also known as “Arbiter,” is a third party that works as
coordinator. Party C is responsible for generating private and public
keys.
keys. (Security of this algorithm is lower than SSHE-LinR, use SSHE-LinR if possible)

The process of HeteroLinR training is shown below:

Expand Down
2 changes: 1 addition & 1 deletion doc/2.0/fate/components/logistic_regression.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ samples stored in databases of the two involved parties. The federated
model is built based on those overlapping samples. The whole sample
alignment process will **not** leak confidential information (e.g.,
sample ids) on the two parties since it is conducted in an encrypted
way.
way. (Security of this algorithm is lower than SSHE-LR, use SSHE-LR if possible)

![Figure 1 (Federated HeteroLR Principle)](../../images/HeteroLR.png)

Expand Down
114 changes: 114 additions & 0 deletions doc/2.0/fate/quick_start.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
## Quick Start

1. install `fate_client` with extra package `fate`

```sh
python -m pip install -U pip && python -m pip install fate_client[fate,fate_flow]==2.0.0
```
after installing packages successfully, initialize fate_flow service and fate_client

```sh
mkdir fate_workspace
fate_flow init --ip 127.0.0.1 --port 9380 --home $(pwd)/fate_workspace
pipeline init --ip 127.0.0.1 --port 9380

fate_flow start
fate_flow status # make sure fate_flow service is started
```


2. download example data

```sh
wget https://raw.githubusercontent.com/wiki/FederatedAI/FATE/example/data/breast_hetero_guest.csv && \
wget https://raw.githubusercontent.com/wiki/FederatedAI/FATE/example/data/breast_hetero_host.csv
```

3. transform example data to dataframe using in fate
```python
import os
from fate_client.pipeline import FateFlowPipeline


base_path = os.path.abspath(os.path.join(__file__, os.path.pardir))
guest_data_path = os.path.join(base_path, "breast_hetero_guest.csv")
host_data_path = os.path.join(base_path, "breast_hetero_host.csv")

data_pipeline = FateFlowPipeline().set_parties(local="0")
guest_meta = {
"delimiter": ",", "dtype": "float64", "label_type": "int64","label_name": "y", "match_id_name": "id"
}
host_meta = {
"delimiter": ",", "input_format": "dense", "match_id_name": "id"
}
data_pipeline.transform_local_file_to_dataframe(file=guest_data_path, namespace="experiment", name="breast_hetero_guest",
meta=guest_meta, head=True, extend_sid=True)
data_pipeline.transform_local_file_to_dataframe(file=host_data_path, namespace="experiment", name="breast_hetero_host",
meta=host_meta, head=True, extend_sid=True)
```
4. run example

```python
from fate_client.pipeline.components.fate import (
HeteroSecureBoost,
Reader,
PSI,
Evaluation
)
from fate_client.pipeline import FateFlowPipeline


# create pipeline for training
pipeline = FateFlowPipeline().set_parties(guest="9999", host="10000")

# create reader task_desc
reader_0 = Reader("reader_0")
reader_0.guest.task_parameters(namespace="experiment", name="breast_hetero_guest")
reader_0.hosts[0].task_parameters(namespace="experiment", name="breast_hetero_host")

# create psi component_desc
psi_0 = PSI("psi_0", input_data=reader_0.outputs["output_data"])

# create hetero secure_boost component_desc
hetero_secureboost_0 = HeteroSecureBoost(
"hetero_secureboost_0", num_trees=1, max_depth=5,
train_data=psi_0.outputs["output_data"],
validate_data=psi_0.outputs["output_data"]
)

# create evaluation component_desc
evaluation_0 = Evaluation(
'evaluation_0', runtime_parties=dict(guest="9999"), metrics=["auc"], input_data=[hetero_secureboost_0.outputs["train_data_output"]]
)

# add training task
pipeline.add_tasks([reader_0, psi_0, hetero_secureboost_0, evaluation_0])

# compile and train
pipeline.compile()
pipeline.fit()

# print metric and model info
print (pipeline.get_task_info("hetero_secureboost_0").get_output_model())
print (pipeline.get_task_info("evaluation_0").get_output_metric())

# deploy task for inference
pipeline.deploy([psi_0, hetero_secureboost_0])

# create pipeline for predicting
predict_pipeline = FateFlowPipeline()

# add input to deployed_pipeline
deployed_pipeline = pipeline.get_deployed_pipeline()
reader_1 = Reader("reader_1")
reader_1.guest.task_parameters(namespace="experiment", name="breast_hetero_guest")
reader_1.hosts[0].task_parameters(namespace="experiment", name="breast_hetero_host")
deployed_pipeline.psi_0.input_data = reader_1.outputs["output_data"]

# add task to predict pipeline
predict_pipeline.add_tasks([reader_1, deployed_pipeline])

# compile and predict
predict_pipeline.compile()
predict_pipeline.predict()
```
Loading