add function for bayes.py