nvflare.app_opt.xgboost.tree_based.model_persistor module

class XGBModelPersistor(save_name='xgboost_model.json', load_as_dict=True)[source]

Bases: ModelPersistor

Abstract class. Implementations will need to implement the load_model() and save_model() methods to persist & load the current ModelLearnable.

Parameters:

filter_id – Optional string that defines a filter component that is applied to prepare the model to be saved, e.g. for serialization of custom Python objects.

handle_event(event: str, fl_ctx: FLContext)[source]

Handles events.

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

  • fl_ctx (FLContext) – FLContext information.

load_model(fl_ctx: FLContext) ModelLearnable[source]

Initialize and load the Model.

Parameters:

fl_ctx – FLContext

Returns:

ModelLearnable object

save_model(model_learnable: ModelLearnable, fl_ctx: FLContext)[source]

Persists the Model object.

Parameters:
  • model_learnable – ModelLearnable object

  • fl_ctx – FLContext