p2pfl.learning.frameworks.xgboost.xgboost_dataset moduleΒΆ

XGBoost DMatrix export integration.

class p2pfl.learning.frameworks.xgboost.xgboost_dataset.XGBoostExportStrategy[source]ΒΆ

Bases: DataExportStrategy

Export strategy for XGBoost datasets.

Converts P2PFL datasets to numpy arrays suitable for XGBoost training.

static export(data, batch_size=None, **kwargs)[source]ΒΆ

Export dataset to numpy arrays for XGBoost.

Parameters:
  • data (Dataset) – The dataset to export.

  • batch_size (int | None) – The batch size for the export (unused for XGBoost).

  • **kwargs –

    Additional keyword arguments: - train (bool): Whether this is training data (default is True). - label_key (str | None): The key for the label column

    (default is None, uses last column).

    • feature_keys (list[str] | None): List of feature column keys

      (default is None, uses all except label).

Returns:

A tuple of (features, labels) as numpy arrays.

Return type:

tuple[np.ndarray, np.ndarray]