pgmpy refactor