nvflare.app_common.executors.statistics.statistics_task_handler module¶
- class StatisticsTaskHandler(generator_id: str, precision: int = 4)[source]¶
Bases:
TaskHandler
StatisticsTaskHandler is to be used together with StatisticsExecutor.
StatisticsExecutor is client-side executor that perform local statistics generation and communication to FL Server global statistics controller. The actual local statistics calculation would delegate to Statistics spec implementor.
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(task_name: str, shareable: Shareable, fl_ctx: FLContext, abort_signal: Signal) Shareable [source]¶
Executes a task.
- Parameters:
task_name – task name
shareable – input data
fl_ctx – FLContext
abort_signal (Signal) – signal to check during execution to determine whether this task is aborted.
- Returns:
Output data
- get_bin_range(feature_name: str, global_min_value: float, global_max_value: float, hist_config: dict) List[float] [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_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]¶
- initialize(fl_ctx: FLContext)[source]¶
This is called when client is start Run. At this point the server hasn’t communicated to the local component yet. :param fl_ctx: fl_ctx: FLContext of the running environment
- pre_run(target_statistics: List[StatisticConfig])[source]¶