dajmcdon / rtestim

https://dajmcdon.github.io/rtestim/
Other
4 stars 0 forks source link

Fix bug in k=0. #50

Closed jiapivialiu closed 1 year ago

jiapivialiu commented 1 year ago

Fix #48.

dajmcdon commented 1 year ago

These are both pretty small modifications. And they would seem to also affect the degree > 0 cases. Can you give me a bit of context as to why this is the fix?

jiapivialiu commented 1 year ago

Both fixes target only the k=0 case and are made only in the functions of dynamic programming (DP) algorithm.

For the $\lambda$ fix, the DP algorithm solves the objective without the loss part divided by the sequence length $n$, but the proximal Newton for degree>0 solves the loss divided by $n$, so $\lambda$ passed into the DP algorithm should be multiplied by $n$, but I forgot it earlier.

The other fix is a typo in the DP algorithm, I made small modifications to the original DP algorithm to take past infections as weights. I divided the original signals by the weights ($yw=y/w$) at the beginning of the algorithm and used $yw$ throughout the algorithm. Using $y$ for these specific lines was a typo.

dajmcdon commented 1 year ago

I see. The difference being that for degree > 0 we use dptf() in the ADMM but for degree = 0 we use dptf_past().

dajmcdon commented 1 year ago

And merge main so I can approve the PR.

jiapivialiu commented 1 year ago

51 solved.