nvflare.app_opt.xgboost.tree_based.executor module

class FedXGBTreeExecutor(training_mode, lr_scale, data_loader_id: str, num_client_bagging: int = 1, lr_mode: str = 'uniform', local_model_path: str = 'model.json', global_model_path: str = 'model_global.json', learning_rate: float = 0.1, objective: str = 'binary:logistic', num_local_parallel_tree: int = 1, local_subsample: float = 1, max_depth: int = 8, eval_metric: str = 'auc', nthread: int = 16, tree_method: str = 'hist', train_task_name: str = 'train', use_gpus=False)[source]

Bases: Executor

Init FLComponent.

The FLComponent is the base class of all FL Components. (executors, controllers, responders, filters, aggregators, and widgets are all FLComponents)

FLComponents have the capability to handle and fire events and contain various methods for logging.

execute(task_name: str, shareable: Shareable, fl_ctx: FLContext, abort_signal: Signal) Shareable[source]

Executes a task.

Parameters:
  • task_name (str) – task name.

  • shareable (Shareable) – input shareable.

  • fl_ctx (FLContext) – fl context.

  • abort_signal (Signal) – signal to check during execution to determine whether this task is aborted.

Returns:

An output shareable.

finalize(fl_ctx: FLContext)[source]
handle_event(event_type: str, fl_ctx: FLContext)[source]

Handles events.

Parameters:
  • event_type (str) – event type fired by workflow.

  • fl_ctx (FLContext) – FLContext information.

initialize(fl_ctx: FLContext)[source]
train(shareable: Shareable, fl_ctx: FLContext, abort_signal: Signal) Shareable[source]
mask_sum_hessian(model: dict) int[source]

Mask sum_hessian values in model trees for privacy protection.

Parameters:

model – XGBoost model dictionary containing learner and gradient_booster

Returns:

Number of trees that were masked