FedTree icon indicating copy to clipboard operation
FedTree copied to clipboard

Python Vertical FL example

Open Martinn1996 opened this issue 3 years ago • 3 comments

Hi, can you provide an example using the Python wrapper for Vertical FL? Currently the examples all make use of Horizontal FL.

Martinn1996 avatar Aug 03 '22 13:08 Martinn1996

Hi @Martinn1996 ,

I have added an example here. You can set ''mode'' to ''vertical'' and ''partition_mode'' to "vertical" to simulate the vertical FL.

QinbinLi avatar Aug 12 '22 12:08 QinbinLi

Thank you! I think there is an error then in the documentation, since it says that the possible value for partition_mode are iid or noniid

I was also wondering how I can make the partition myself? As in, can I decide which features belongs to which party, thanks in advance.

Martinn1996 avatar Aug 12 '22 14:08 Martinn1996

Hi @Martinn1996 ,

Thanks for the information! I have corrected the document. For the partition, you can manually partition the dataset into multiple subsets and use the CLI interface to conduct training by specifying them as data. For example, the configuration file example.conf is

data=./dataset/credit/credit_vertical_p0_withlabel.csv,./dataset/credit/credit_vertical_p1.csv
test_data=./dataset/credit/credit_vertical_p0_withlabel.csv,./dataset/credit/credit_vertical_p1.csv
model_path=fedtree.model
n_class=2
data_format=csv
n_parties=2
objective=binary:logistic
mode=vertical
privacy_tech=none
n_trees=10
depth=6
max_num_bin=16
learning_rate=0.1

Then run ./build/bin/FedTree-train example.conf.

We'll integrate this feature into Python interface. Thanks!

QinbinLi avatar Aug 13 '22 06:08 QinbinLi