FATE icon indicating copy to clipboard operation
FATE copied to clipboard

coodinated lr中CoordinatedLREstimatorGuest在计算loss时有问题

Open lvying0019 opened this issue 1 year ago • 5 comments
trafficstars

image

以上代码为coodinated lr中CoordinatedLREstimatorGuest在计算loss时的一部分公式,这里面公式是不是应该改成

loss += 2 / h * Xw2_h

lvying0019 avatar Jan 20 '24 14:01 lvying0019

loss计算公式请参考:https://github.com/FederatedAI/FATE/blob/v2.0.0/python/fate/ml/glm/hetero/coordinated_lr/guest.py#L330

nemirorox avatar Jan 23 '24 02:01 nemirorox

loss计算公式请参考:https://github.com/FederatedAI/FATE/blob/v2.0.0/python/fate/ml/glm/hetero/coordinated_lr/guest.py#L330

公式没有错,但是Xw2_h 在host方计算的时候是通过以下两步完成的 Xw_h = 0.25 * torch.matmul(X, w.detach()) batch_ctx.guest.put("Xw2_h", encryptor.encrypt_tensor(torch.matmul(Xw_h.T, Xw_h))) 也就是guest收到的Xw2_h = 1/16 * X_h *w

在损失函数的项会变成loss += 1 / h * 0.125 * Xw2_h = 2 / h * Xw2_h

lvying0019 avatar Jan 23 '24 03:01 lvying0019

好的,非常感谢指出问题。 我们欢迎社区贡献代码修改pr(代码需合并最新main分支,并signoff cmmit),请问是否有pr的计划呢?

nemirorox avatar Jan 23 '24 06:01 nemirorox

好的,非常感谢指出问题。 我们欢迎社区贡献代码修改pr(代码需合并最新main分支,并signoff cmmit),请问是否有pr的计划呢?

我尝试了好几次,但是cdo一直不过,就先不提pr了

lvying0019 avatar Jan 24 '24 14:01 lvying0019

关于git signoff的问题,FATE repo要求commit message内需要加入signoff信息。

如使用git command line,可参考此文档:https://git-scm.com/docs/git-commit#Documentation/git-commit.txt---signoff

如使用pycharm,可以参考此文档:https://www.jetbrains.com/help/pycharm/commit-and-push-changes.html#commit

如果还有相关其他问题,欢迎提出。或者如果cdo还是无法通过,可以由我们负责代码修改pr,并link本issue。

nemirorox avatar Jan 30 '24 09:01 nemirorox