Closed hehyuan closed 2 months ago
WeightME is implemented in just 1 line (below # evaluate models
), the first part of the function samples the models.
The code indeed looks a little different from the equation in Def. 5.1. The reason for this is that the code doesn't directly calculate WeightME, but will generate the correct WeightME gradients when PyTorch backprops through it. (This is quite standard for gradient estimators, e.g. look at REINFORCE implementations.) Note that get_lit_weights
returns log-probabilities, so when the PyTorch backprops through these you get $\nabla \log w(x) = 1/w(x)$.
Hope this makes it more clear.
Hi, nice work! I have read your solid paper, and I am interested in your work. Since I have read your code, I am still confused about how WeightME is implemented.
If I have understand correct, the core implementation is in
solvers/cms_gen.py
, and in the function below:Could you further explain how the above function is related with Definition 5.1 in your paper?
Best regards!