add Bayes algorithm