nvflare.app_common.executors.statistics.statistics_executor module

class StatisticsExecutor(generator_id: str, precision=4)[source]

Bases: Executor

Parameters:
  • generator_id – Id of the statistics component

  • precision – number of precision digits

execute(task_name: str, shareable: Shareable, fl_ctx: FLContext, abort_signal: Signal) Shareable[source]
finalize(fl_ctx: FLContext)[source]
get_bin_range(feature_name: str, global_min_value: float, global_max_value: float, hist_config: dict) List[int][source]
get_count(dataset_name: str, feature_name: str, statistic_configs: StatisticConfig, inputs: Shareable, fl_ctx: FLContext) int[source]
get_failure_count(dataset_name: str, feature_name: str, statistic_configs: StatisticConfig, inputs: Shareable, fl_ctx: FLContext) int[source]
get_histogram(dataset_name: str, feature_name: str, statistic_configs: StatisticConfig, inputs: Shareable, fl_ctx: FLContext) Histogram[source]
get_max_value(dataset_name: str, feature_name: str, statistic_configs: StatisticConfig, inputs: Shareable, fl_ctx: FLContext) float[source]

get randomized max value

get_mean(dataset_name: str, feature_name: str, statistic_configs: StatisticConfig, inputs: Shareable, fl_ctx: FLContext) float[source]
get_min_value(dataset_name: str, feature_name: str, statistic_configs: StatisticConfig, inputs: Shareable, fl_ctx: FLContext) float[source]

get randomized min value

get_number_of_bins(feature_name: str, hist_config: dict) int[source]
get_numeric_features() Dict[str, List[Feature]][source]
get_stddev(dataset_name: str, feature_name: str, statistic_configs: StatisticConfig, inputs: Shareable, fl_ctx: FLContext) float[source]
get_sum(dataset_name: str, feature_name: str, statistic_configs: StatisticConfig, inputs: Shareable, fl_ctx: FLContext) float[source]
get_variance_with_mean(dataset_name: str, feature_name: str, statistic_configs: StatisticConfig, inputs: Shareable, fl_ctx: FLContext) float[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]
pre_run(target_statistics: List[StatisticConfig])[source]
statistic_functions() dict[source]