Skip to content

Commit

Permalink
XGBoost -- Fix node_id issue to fit FDSv0.0.2 (#2624)
Browse files Browse the repository at this point in the history
Co-authored-by: yan-gao-GY <[email protected]>
  • Loading branch information
yan-gao-GY and yan-gao-GY authored Nov 21, 2023
1 parent 1ad038b commit 821d843
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 8 deletions.
2 changes: 1 addition & 1 deletion doc/source/tutorial-quickstart-xgboost.rst
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ Prior to local training, we require loading the HIGGS dataset from Flower Datase
fds = FederatedDataset(dataset="jxie/higgs", partitioners={"train": partitioner})
# Load the partition for this `node_id`
partition = fds.load_partition(idx=args.node_id, split="train")
partition = fds.load_partition(node_id=args.node_id, split="train")
partition.set_format("numpy")
In this example, we split the dataset into two partitions with uniform distribution (:code:`IidPartitioner(num_partitions=2)`).
Expand Down
6 changes: 4 additions & 2 deletions examples/xgboost-comprehensive/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,15 @@
partitioner_type=partitioner_type, num_partitions=num_partitions
)
fds = FederatedDataset(
dataset="jxie/higgs", partitioners={"train": partitioner}, resplitter=resplit
dataset="jxie/higgs",
partitioners={"train": partitioner},
resplitter=resplit,
)

# Load the partition for this `node_id`
log(INFO, "Loading partition...")
node_id = args.node_id
partition = fds.load_partition(idx=node_id, split="train")
partition = fds.load_partition(node_id=node_id, split="train")
partition.set_format("numpy")

if args.centralised_eval:
Expand Down
2 changes: 1 addition & 1 deletion examples/xgboost-comprehensive/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ authors = ["The Flower Authors <[email protected]>"]

[tool.poetry.dependencies]
python = ">=3.8,<3.11"
flwr = ">=1.0,<2.0"
flwr-nightly = ">=1.0,<2.0"
flwr-datasets = ">=0.0.2,<1.0.0"
xgboost = ">=2.0.0,<3.0.0"
2 changes: 1 addition & 1 deletion examples/xgboost-comprehensive/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
flwr>=1.0, <2.0
flwr-nightly>=1.0, <2.0
flwr-datasets>=0.0.2, <1.0.0
xgboost>=2.0.0, <3.0.0
2 changes: 1 addition & 1 deletion examples/xgboost-quickstart/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def transform_dataset_to_dmatrix(data: Union[Dataset, DatasetDict]) -> xgb.core.

# Load the partition for this `node_id`
log(INFO, "Loading partition...")
partition = fds.load_partition(idx=args.node_id, split="train")
partition = fds.load_partition(node_id=args.node_id, split="train")
partition.set_format("numpy")

# Train/test splitting
Expand Down
2 changes: 1 addition & 1 deletion examples/xgboost-quickstart/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ authors = ["The Flower Authors <[email protected]>"]

[tool.poetry.dependencies]
python = ">=3.8,<3.11"
flwr = ">=1.0,<2.0"
flwr-nightly = ">=1.0,<2.0"
flwr-datasets = ">=0.0.1,<1.0.0"
xgboost = ">=2.0.0,<3.0.0"
2 changes: 1 addition & 1 deletion examples/xgboost-quickstart/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
flwr>=1.0, <2.0
flwr-nightly>=1.0, <2.0
flwr-datasets>=0.0.1, <1.0.0
xgboost>=2.0.0, <3.0.0

0 comments on commit 821d843

Please sign in to comment.