microsoft / causica

MIT License
430 stars 56 forks source link

Access weighted adjacency matrix of a trained model #95

Open zhu-yh1 opened 8 months ago

zhu-yh1 commented 8 months ago

Hi team,

I was running DECI on my own dataset. According to examples/multi_investment_sales_attribution.ipynb, I was able to output a binary adjacency matrix from my trained model.

I am wondering if it is possible to access the weighted adjacency matrix the model actually optimized during the training process, instead of only the binary matrix.

Thank you and look forward to your reply!

meyerscetbon commented 7 months ago

Hi,

In order to access to the parameters learned of the underlying independent Bernoulli distribution, you can compute the mean sem instead of the mode one. That is sem_mean = sem_module().mean instead of sem_mode = sem_module().mode and obtain the parameters of the Bernoulli's by computing sem_mean.graph.

I hope this helps,

Cheers,