Skip to content
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

关于escm2算法的疑问 #941

Open
huzuoliang opened this issue Jul 28, 2023 · 0 comments
Open

关于escm2算法的疑问 #941

huzuoliang opened this issue Jul 28, 2023 · 0 comments

Comments

@huzuoliang
Copy link

def counterfact_ipw(self, loss_cvr, ctr_num, O, ctr_out_one):
    PS = paddle.multiply(
        ctr_out_one, paddle.cast(
            ctr_num, dtype="float32"))
    min_v = paddle.full_like(PS, 0.000001)
    PS = paddle.maximum(PS, min_v)
    IPS = paddle.reciprocal(PS)
    batch_shape = paddle.full_like(O, 1)
    batch_size = paddle.sum(paddle.cast(
        batch_shape, dtype="float32"),
                            axis=0)
    #TODO this shoud be a hyparameter
    IPS = paddle.clip(IPS, min=-15, max=15)  #online trick 
    IPS = paddle.multiply(IPS, batch_size)
    IPS.stop_gradient = True
    loss_cvr = paddle.multiply(loss_cvr, IPS)
    loss_cvr = paddle.multiply(loss_cvr, O)
    return paddle.mean(loss_cvr)

IPW方法为什么要乘batch_size,论文中也没发现需要做这个操作?IPS = paddle.multiply(IPS, batch_size)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant