r - Naive Bayes implementation -
in project, used naive bayes implementation "e1071" library , time execution large. then, used naive bayes implementation "nblearn", , results similar execution time 10 times smaller!
has noticed same? can reason that?
testnaivebayes <-function(formula, trainingdata, testdata) { model <- naivebayes(formula, trainingdata) pred <- predict(model, testdata) result <- calcratesfor(formula, testdata, pred ) result } testnb <-function(formula, trainingdata, testdata) { cl <- tostring(formula[[2]]) model <- naive.bayes(trainingdata, cl) pred <- predict(model, testdata) result <- calcratesfor(formula, testdata, pred ) result }
Comments
Post a Comment