1
$\begingroup$

I learned how to use libpgm in general for Bayesian inference and learning, but I do not understand if I can use it for learning with hidden variable. More precisely, I am trying to implement approach for Social Network Analysing from this paper: Modeling Relationship Strength in Online Social Networks. They suggest to use following architecture Proposed BN in paper

Here

  • S(ij) represents vector of similarity between user i and j - Observed
  • z(ij) is a hidden variable - relationship strength (Normal distribution regularised by W - weights and similarity vector)- Hidden
  • yt(ij) is user interaction(1,2…n -> certain type of interaction e.g. 1=I retweeted j) (function of z and a that involves Theta parameter) - Observed
  • at(ij) is auxiliary variable which represents how often certain interaction occurs - Observed

Approach described in paper for training is quite difficult and involves coding of ascent optimisation. I wonder If I can use libpgm to learn W and Theta parameters. If yes, how to do it? If no, what libraries I can use to do it.

$\endgroup$

1 Answer 1

1
$\begingroup$

While this model could be implementable in the libpgm library (it seems to have quite rigid interface tailored to several special models, though), it will not allow you to reproduce the results of this paper. In the paper authors actually do something way simpler than Bayesian Inference – they only perform maximum-aposteriori (MAP) inference, which is way easier, but does tell you how confident the model is.

You don't have to code optimization algorithms for MAP inference by yourself, these days there are powerful and general packages that do almost everything for you. You can use automatic differentiation features of TensorFlow / PyTorch – they will compute the gradients and run optimization algorithm for you. You can also use numpy.autograd to get gradients for free, and then run any optimizer you like (check out scipy.optimize). The autograd + scipy.optimize pair is particularly neat if you wanna use more advanced optimization methods, e.g. 2nd order ones.

All these methods will give you values (point estimates) of $w, \theta, z$ that you can use to make inferences. However, if you want to have more than point estimates, and would like to do find all possible values (along with their probabilities) and maybe Bayesian Model Averaging, you'll need more powerful libraries enabling probabilistic programming. There are Edward (built upon TensorFlow), Pyro (built upon PyTorch), Stan and others.

If you feel overwhelmed by the choices, I recommend going with PyTorch.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.