Bayesian learnig of structured dynamical systems