A Bayesian Approach to Policy Recognition and State Representation Learning