-
Notifications
You must be signed in to change notification settings - Fork 101
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
使用 SPU 实现逻辑回归算法基础功能 #211
Comments
imwangyt Give it to me |
经沟通,该任务已经回收,目前为待认领状态哈,欢迎小伙伴们继续认领~ |
tarantula-leo Give it to me |
报错信息 [libspu/kernel/hlo/control_flow.cc:133] While with secret condition is not supported |
Q1:我理解是的,否则你无法知道是否需要继续 Q2: spu中是可以将秘文转化为明文的,取决于你运行的方式; Q3: 不是很理解各类情况是什么意思? |
Q2:现在的early stop功能在spu中可以通过什么方式实现呢?看其中有这个要求 上述代码的实现方式是需要支持While with secret condition,其他的功能代码中都包含(https://github.com/secretflow/spu/blob/main/sml/linear_model/simple_sgd.py) |
Q2: 如果要实现early stop就需要明密文混合编程,其实现的框架大概会变成: for _ in range(max_iter):
flag = spu_device(model.fit)(x) # run program in spa
flag = ppd.reveal()
# early stop
if flag:
break 但我们这次其实是希望end-to-end的实现,即 model.fit() # do all training work in one fit. 所以,您可以先不用实现early stop,就以一个指定的最大迭代次数即可。 Q3: 额,,还是不理解,spu并不支持while的条件为密文,所以也不会泄漏条件的明文值,至于您说的“条件的生成过程”,是指python报错的trace会指向 |
简单来说,只要您不手动reveal数据,理论上是不会有更多泄漏的。 Thanks |
early stop功能如果不用实现的话,这份代码是不是已经完成了?
Output: |
那您可以先发pr,我这边review然后运行一下。 |
https://github.com/secretflow/spu/blob/main/sml/linear_model/simple_sgd.py |
嗯嗯,,功能上那份代码是满足的,,但是那份代码主要是我们实现了用作实例的,api设计比较随意。 我们希望api能尽量接近sklearn的lr分类器(这个算法里也不需要线性回归模型的支持,后续我们会有专门的线性回归模型任务)。您可以参考sklearn的LR稍微重构一下api,并预留一些参数。
|
类似这样么?
|
嗯嗯,像这种能枚举的可以这样。 |
赞~辛苦您整理完相关内容之后 以 PR 的形式提交哈~ 期待您的 PR |
|
感谢您的提交,正确性是没有问题的。但有几个点需要麻烦您再修改一下:
另外,下次您可以正式发起PR了,并将上述代码进行拆分,需要提交的文件和位置可以参考 #240 |
PR的文件路径是在原liner_model下更改还是需要新建路径? |
新建一个路径吧,以后LR相关的内容都会更新在这里,,原liner_model还是作为一个样例文件夹 感谢 |
任务介绍
详细要求
能力要求
操作说明
The text was updated successfully, but these errors were encountered: