FedTree icon indicating copy to clipboard operation
FedTree copied to clipboard

How to train a random forests model?

Open hy101 opened this issue 3 years ago • 4 comments

Random forests model is mentioned in the FedTree draft paper, could you please add some example code for that

hy101 avatar Nov 21 '22 10:11 hy101

You have to set the "bagging" option to 1. It is not mentioned in the docs

Ch33s3Burger avatar Nov 28 '22 12:11 Ch33s3Burger

Hi @hy101 and @Ch33s3Burger ,

Currently random forest is implemented by merging all trees trained by different parties in the federated setting. There is no performance guarantee for the federated random forest. If setting bagging=1, FedTree takes the average of the output of each tree as the prediction value. More features (e.g., instance and feature bagging) and documentation will come in the future.

QinbinLi avatar Dec 02 '22 02:12 QinbinLi

Those are the parameters i set to train a random forest model. Are those parameters correct to simulate the training of a federated forest model with the data?

clf = FLRegressor(n_trees=1, n_parties=NUM_CLIENTS, mode="horizontal",
                  max_depth=MAX_DEPTH, objective="reg:linear", bagging=1, n_parallel_trees=NUM_TREES)
clf.fit(x_train, y_train)

Ch33s3Burger avatar Dec 02 '22 12:12 Ch33s3Burger

Hi @Ch33s3Burger ,

No, your code will only train a single tree. FedTree does not support n_parallel_trees currently. I'll let you know when this parameter is enabled.

QinbinLi avatar Dec 03 '22 05:12 QinbinLi