nvflare.app_common.widgets.intime_model_selector module

class IntimeModelSelectionHandler(*args, **kwargs)[source]

Bases: IntimeModelSelector

Handler to determine if the model is globally best.

Parameters:
  • weigh_by_local_iter (bool, optional) – whether the metrics should be weighted by trainer’s iteration number.

  • aggregation_weights (dict, optional) – a mapping of client name to float for aggregation. Defaults to None.

  • validation_metric_name (str, optional) – key used to save initial validation metric in the DXO meta properties (defaults to MetaKey.INITIAL_METRICS).

  • key_metric – if metrics are a dict, key_metric can select the metric used for global model selection. Defaults to “val_accuracy”.

  • negate_key_metric – Whether to invert the key metric. Should be used if key metric is a loss. Defaults to False.

class IntimeModelSelector(weigh_by_local_iter=False, aggregation_weights=None, validation_metric_name='initial_metrics', key_metric: str = 'val_accuracy', negate_key_metric: bool = False)[source]

Bases: Widget

Handler to determine if the model is globally best.

Parameters:
  • weigh_by_local_iter (bool, optional) – whether the metrics should be weighted by trainer’s iteration number.

  • aggregation_weights (dict, optional) – a mapping of client name to float for aggregation. Defaults to None.

  • validation_metric_name (str, optional) – key used to save initial validation metric in the DXO meta properties (defaults to MetaKey.INITIAL_METRICS).

  • key_metric – if metrics are a dict, key_metric can select the metric used for global model selection. Defaults to “val_accuracy”.

  • negate_key_metric – Whether to invert the key metric. Should be used if key metric is a loss. Defaults to False.

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.