Skip to content

Commit

Permalink
select random mode when counts equal
Browse files Browse the repository at this point in the history
Signed-off-by: Yu Wu <[email protected]>
  • Loading branch information
nemirorox committed Nov 22, 2023
1 parent ec38c52 commit c21a8ba
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion python/federatedml/statistic/statics.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'))
Expand Down

0 comments on commit c21a8ba

Please sign in to comment.