From c21a8bace1d2dd51fea003e4ee00a36347638d71 Mon Sep 17 00:00:00 2001 From: Yu Wu Date: Wed, 22 Nov 2023 14:43:58 +0800 Subject: [PATCH] select random mode when counts equal Signed-off-by: Yu Wu --- python/federatedml/statistic/statics.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/federatedml/statistic/statics.py b/python/federatedml/statistic/statics.py index d0696b2309..26db96eb6e 100755 --- a/python/federatedml/statistic/statics.py +++ b/python/federatedml/statistic/statics.py @@ -566,7 +566,7 @@ def __aggregate_count_per_val_in_col(kv_iterator, header): if col_dict[col_name]['max_count'] < v: col_dict[col_name] = {'max_count': v, 'max_val': [k[1]]} elif col_dict[col_name]['max_count'] == v: - col_dict[col_name]['max_val'].append(k[1]) + col_dict[col_name]['max_val'] = random.choice([k[1], col_dict[col_name]['max_val']]) return col_dict func = functools.partial(__aggregate_count_per_val_in_col, header=data.schema.get('header'))