Togaware DATA MINING
Desktop Survival Guide
by Graham Williams
Google


Naive Bayes

Use Weka:



     ## Create an interface to Weka's Naive Bayes classifier.
     NB <- make_Weka_classifier("weka/classifiers/bayes/NaiveBayes")
     ## Note that this has a very useful print method:
     NB
     ## And we can use the Weka Option Wizard for finding out more:
     WOW(NB)
     ## And actually use the interface ...
     if(require("e1071", quietly = TRUE) &&
        require("mlbench", quietly = TRUE)) {
         data("HouseVotes84", package = "mlbench")
         model <- NB(Class ~ ., data = HouseVotes84)
         predict(model, HouseVotes84[1:10, -1])
         predict(model, HouseVotes84[1:10, -1], type = "prob")
     }
     ## (Compare this to David Meyer's naiveBayes() in package 'e1071'.)

Todo: UNDER CONSTRUCTION



Subsections

Copyright © 2004-2010 Togaware Pty Ltd
Support further development through the purchase of the PDF version of the book.
The PDF version is a formatted comprehensive draft book (with over 800 pages).
Brought to you by Togaware. This page generated: Sunday, 22 August 2010