tristandeleu / jax-dag-gflownet

Code for "Bayesian Structure Learning with Generative Flow Networks"
MIT License
78 stars 16 forks source link

can you explain the meaning of the 'Embedding of the edges' in the code? #1

Closed AmGracee closed 1 year ago

AmGracee commented 1 year ago

hi, Thank you very much for sharing the source codes.

edges = jnp.stack((sources, num_variables + targets), axis=1) Line 48 in nets/gflownet.py

I don't understand why targets shoule be added with num_variables? Could you tell me what it means?

tristandeleu commented 1 year ago

sources and targets are the indices of the source and target for each edge; they are integers in [0, num_variables - 1]. The reason why we are adding num_variables to targets is to use a different embedding for the sources and the targets (num_variables is just an offset). We have 2 * num_variables embeddings to learn in total, the first num_variables are embeddings for the sources, and the last num_variables are embeddings for the targets.

AmGracee commented 1 year ago

Thanks. I got it!