Implement multi-threaded Naive-bayes