pengxingang / Pocket2Mol

Pocket2Mol: Efficient Molecular Sampling Based on 3D Protein Pockets
MIT License
242 stars 65 forks source link

about the KL divergence #15

Closed BL-Lac149597870 closed 1 year ago

BL-Lac149597870 commented 1 year ago

Hi, thanks for the awesome works!

I met a problem when caculating the KL divergence of molecular bond angles between training and testing sets. As I noticed that you caculated the KL divergence of the bond angles and dihedral angles with the test set. May I ask you to kindly provide the corresponding codes?

pengxingang commented 1 year ago

Thanks for your interest in our work. We uploaded evaluation/ring_angle_diheral.ipynb in our last update. It contained the codes about the calculation of KL divergence and the calculation of bond angles and dihedral angles. You can refer to that file and see whether it can solve your problem.

BL-Lac149597870 commented 1 year ago

Thanks for your reply!
My confusion is, when caculating KL between P and Q, we always need two discrete probability distributions p_i and q_i. Now I have the dihedral angles, but how can I convert them into discrete probability distributions? As shown in the following, it seems that the scipy api only takes two discrete probability distributions as input.

image
pengxingang commented 1 year ago

We can discretize the continuous angle values into binned values, just like calculating the empirical distributions. For example, using one degree as the bin width can transfer the angle space into a discrete space with 180 classes.

BL-Lac149597870 commented 1 year ago

Thanks very much!!!