From 6a47b5f2452df32398b44fbe8b4951c04683907e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Knaebel?= Date: Sun, 17 Sep 2017 10:23:23 +0200 Subject: [PATCH] add sample weights function to utils for later usage --- utils.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/utils.py b/utils.py index 187e9d3..636e3a7 100644 --- a/utils.py +++ b/utils.py @@ -16,3 +16,7 @@ def get_custom_class_weights(client, server): "client": client_class_weight, "server": server_class_weight } + + +def get_custom_sample_weights(client, server): + return class_weight.compute_sample_weight("balanced", np.vstack((client, server)).T)