andrew-cr / tauLDR

Code for the paper https://arxiv.org/abs/2205.14987v2
Other
42 stars 7 forks source link

Clarification Needed on +1 Addition in Detailed Balance Condition #5

Closed MHGanainy closed 8 months ago

MHGanainy commented 8 months ago

Hello,

I am currently exploring the implementation details of the tauLDR model and have a question regarding the detailed balance condition as implemented in the code. Specifically, I am referring to the line in models.py:

rate[i, j] = rate[j, i] * np.exp(- ( (j+1)**2 - (i+1)**2 + S*(i+1) - S*(j+1) ) / (2 * self.Q_sigma**2) )

https://github.com/andrew-cr/tauLDR/blob/5128d4a5cce07f707780ccb03e8de2b48950aafa/lib/models/models.py#L215

My question pertains to the addition of +1 in each term of the numerator within the exponential function. Upon reviewing Appendix E of the associated paper, I did not find a mention or requirement for adding 1 to the indices i and j in the detailed balance condition.

Could you please provide some insight into the rationale behind this addition? Is it related to a zero-indexing adjustment for Python, or is there another theoretical justification or correction applied here that might not be immediately apparent from the paper's description?

Understanding the reasoning behind this discrepancy will greatly aid in my comprehension of the model's implementation and ensure alignment with the theoretical foundations laid out in the paper.

Thank you for your time and for your contributions to this fascinating project.

andrew-cr commented 8 months ago

Hi!

Thank you for your interest in the project.

This comes from how we define \mu_0 in Appendix E. We define it as S/2 - 1 since in this discrete space we have to make some arbitrary decision as to which discrete point our center point will lie and we just err on the side of it being slightly closer to the left side rather than slightly closer to the right side in general. E.g. if S=8, then we have the center point be 3 rather than 4: 0, 1, 2, 3, 4, 5, 6, 7

If you substitute in \mu_0 = S/2 -1 into the detailed balance condition for defining our Gaussian rate matrix you should obtain the formula implemented in the code.

Please do let me know if you have any further questions

MHGanainy commented 8 months ago

Hi @andrew-cr,

Thank you very much for your swift and detailed response!

I appreciate the time and effort you took to break down the concept and its application within the project.