Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Primihub
PrimiHub
提交
d749eca8
P
PrimiHub
项目概览
Primihub
/
PrimiHub
10 个月 前同步成功
通知
21
Star
1
Fork
1
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
PrimiHub
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
未验证
提交
d749eca8
编写于
6月 15, 2023
作者:
X
Xuefeng Xu
提交者:
GitHub
6月 15, 2023
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
use roc vertical averaging in HFL to save communication overhead (#518)
上级
9f052f37
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
18 addition
and
30 deletion
+18
-30
python/primihub/FL/logistic_regression/hfl_client.py
python/primihub/FL/logistic_regression/hfl_client.py
+1
-1
python/primihub/FL/logistic_regression/hfl_server.py
python/primihub/FL/logistic_regression/hfl_server.py
+7
-13
python/primihub/FL/neural_network/hfl_client.py
python/primihub/FL/neural_network/hfl_client.py
+1
-1
python/primihub/FL/neural_network/hfl_server.py
python/primihub/FL/neural_network/hfl_server.py
+9
-15
未找到文件。
python/primihub/FL/logistic_regression/hfl_client.py
浏览文件 @
d749eca8
...
...
@@ -279,7 +279,7 @@ class Plaintext_Client:
drop_intermediate
=
False
)
self
.
server_channel
.
send
(
"fpr"
,
fpr
)
self
.
server_channel
.
send
(
"tpr"
,
tpr
)
self
.
server_channel
.
send
(
"thresholds"
,
thresholds
)
#
self.server_channel.send("thresholds", thresholds)
# ks
ks
=
ks_from_fpr_tpr
(
fpr
,
tpr
)
...
...
python/primihub/FL/logistic_regression/hfl_server.py
浏览文件 @
d749eca8
...
...
@@ -6,7 +6,7 @@ from primihub.utils.logger_util import logger
import
json
import
numpy
as
np
from
phe
import
paillier
from
primihub.FL.metrics.hfl_metrics
import
fpr_tpr_merge2
,
\
from
primihub.FL.metrics.hfl_metrics
import
roc_vertical_avg
,
\
ks_from_fpr_tpr
,
\
auc_from_fpr_tpr
from
.base
import
PaillierFunc
...
...
@@ -157,21 +157,15 @@ class Plaintext_DPSGD_Server:
def
get_fpr_tpr
(
self
):
client_fpr
=
self
.
client_channel
.
recv_all
(
'fpr'
)
client_tpr
=
self
.
client_channel
.
recv_all
(
'tpr'
)
client_thresholds
=
self
.
client_channel
.
recv_all
(
'thresholds'
)
#
client_thresholds = self.client_channel.recv_all('thresholds')
# fpr & tpr
#
Note: fpr_tpr_merge2 only support two clients
# use ROC averaging when for multiple clients
#
roc_vertical_avg: sample = 0.1 * n
samples
=
int
(
0.1
*
sum
(
self
.
num_examples_weights
))
fpr
,
\
tpr
,
\
thresholds
=
fpr_tpr_merge2
(
client_fpr
[
0
],
client_tpr
[
0
],
client_thresholds
[
0
],
client_fpr
[
1
],
client_tpr
[
1
],
client_thresholds
[
1
],
self
.
num_positive_examples_weights
,
self
.
num_negtive_examples_weights
)
tpr
=
roc_vertical_avg
(
samples
,
client_fpr
,
client_tpr
)
return
fpr
,
tpr
def
get_metrics
(
self
):
...
...
python/primihub/FL/neural_network/hfl_client.py
浏览文件 @
d749eca8
...
...
@@ -317,7 +317,7 @@ class Plaintext_Client:
drop_intermediate
=
False
)
self
.
server_channel
.
send
(
"fpr"
,
fpr
)
self
.
server_channel
.
send
(
"tpr"
,
tpr
)
self
.
server_channel
.
send
(
"thresholds"
,
thresholds
)
#
self.server_channel.send("thresholds", thresholds)
client_metrics
[
'train_fpr'
]
=
fpr
client_metrics
[
'train_tpr'
]
=
tpr
...
...
python/primihub/FL/neural_network/hfl_server.py
浏览文件 @
d749eca8
...
...
@@ -6,9 +6,9 @@ from primihub.utils.logger_util import logger
import
json
import
numpy
as
np
import
torch
from
primihub.FL.metrics.hfl_metrics
import
fpr_tpr_merge2
,
\
ks_from_fpr_tpr
,
\
auc_from_fpr_tpr
from
primihub.FL.metrics.hfl_metrics
import
roc_vertical_avg
,
\
ks_from_fpr_tpr
,
\
auc_from_fpr_tpr
from
.base
import
create_model
...
...
@@ -203,21 +203,15 @@ class Plaintext_Server:
def
get_fpr_tpr
(
self
):
client_fpr
=
self
.
client_channel
.
recv_all
(
'fpr'
)
client_tpr
=
self
.
client_channel
.
recv_all
(
'tpr'
)
client_thresholds
=
self
.
client_channel
.
recv_all
(
'thresholds'
)
#
client_thresholds = self.client_channel.recv_all('thresholds')
# fpr & tpr
#
Note: fpr_tpr_merge2 only support two clients
# use ROC averaging when for multiple clients
#
roc_vertical_avg: sample = 0.1 * n
samples
=
int
(
0.1
*
sum
(
self
.
num_examples_weights
))
fpr
,
\
tpr
,
\
thresholds
=
fpr_tpr_merge2
(
client_fpr
[
0
],
client_tpr
[
0
],
client_thresholds
[
0
],
client_fpr
[
1
],
client_tpr
[
1
],
client_thresholds
[
1
],
self
.
num_positive_examples_weights
,
self
.
num_negtive_examples_weights
)
tpr
=
roc_vertical_avg
(
samples
,
client_fpr
,
client_tpr
)
return
fpr
,
tpr
def
get_metrics
(
self
):
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录