-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
1 parent
17dd415
commit a4ae25e
Showing
16 changed files
with
58 additions
and
428 deletions.
There are no files selected for viewing
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 |
---|---|---|
@@ -1,47 +1,15 @@ | ||
# FGBoost Regression Python Example | ||
# FGBoost Regression Example | ||
This example shows how to build a 2-clients FGBoost Regression application. | ||
|
||
### Walkthrough | ||
We provide the full code below, which you could directly run once BigDL PPML [installation](#link) done. | ||
```python | ||
import numpy as np | ||
from bigdl.ppml import FLServer | ||
from bigdl.ppml.algorithms.fgboost_regression import FGBoostRegression | ||
from bigdl.ppml.utils import init_fl_context | ||
### Data | ||
This example uses [House Price]() dataset from Kaggle. We provide a copy of dataset [here](), and split the dataset in two parts by [split script](). | ||
|
||
fl_server = FLServer() | ||
fl_server.build() | ||
fl_server.start() | ||
init_fl_context() | ||
The data files used here are [vfl-house-price-1.csv](), [vfl-house-price-2.csv](), which represent the two data files held by two parties. | ||
|
||
x, y = np.ones([2, 3]), np.ones([2]) | ||
fgboost_regression = FGBoostRegression() | ||
fgboost_regression.fit(x, y) | ||
result = fgboost_regression.predict(x) | ||
result | ||
|
||
fl_server.close() | ||
``` | ||
Now we dive into the code. | ||
### Start FLServer | ||
To start a BigDL PPML application, you first start a FLServer by | ||
```python | ||
fl_server = FLServer() | ||
fl_server.build() | ||
fl_server.start() | ||
``` | ||
### Initialize FLContext | ||
The client to interact with FLServer is inside FLContext, to use it, initialize the FLContext by | ||
```python | ||
init_fl_context() | ||
``` | ||
|
||
|
||
### Run Algorithm | ||
Then create a `FGBoostRegression` instance to apply Federated Gradient Boosting Regression algorithm, and call train and predict on dummy data. | ||
```python | ||
fgboost_regression = FGBoostRegression() | ||
fgboost_regression.fit(x, y) | ||
result = fgboost_regression.predict(x) | ||
result | ||
``` | ||
|
||
### Model Save and Load | ||
//TODO | ||
|
||
### Model Save and Load |
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
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
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
44 changes: 0 additions & 44 deletions
44
python/ppml/test/bigdl/ppml/algorithms/test_fgboost_regression.py
This file was deleted.
Oops, something went wrong.
40 changes: 0 additions & 40 deletions
40
python/ppml/test/bigdl/ppml/algorithms/test_hfl_linear_regression.py
This file was deleted.
Oops, something went wrong.
40 changes: 0 additions & 40 deletions
40
python/ppml/test/bigdl/ppml/algorithms/test_hfl_logistic_regression.py
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
40 changes: 0 additions & 40 deletions
40
python/ppml/test/bigdl/ppml/algorithms/test_vfl_linear_regression.py
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.