Implementing Expectation Propagation on a Factor Graph.