From the course: Spark for Machine Learning & AI

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Naive Bayes classification

Naive Bayes classification - Apache Spark Tutorial

From the course: Spark for Machine Learning & AI

Start my 1-month free trial

Naive Bayes classification

- [Instructor] Now it's time to work with the Naive Bayes classifier. Now we're starting from where we left off in the previous video, and as you may recall, we have a data frame, which has the indexed and vectorized iris data, and I called that ivirs _df. Let's just take a look at the first row just to familiarize ourselves again with the data structure. So, we have our raw data from the file which includes sepal length, sepal width, petal length, petal width. We have the species, then we have our feature vector, which has some numeric measures, and we have label, which in this case just shows a 0, but labels are 0, 1, or 2 in this data set, depending on which species that particular row applies to. So, we're working with Naive Bayes, so let's import some code to support that, so we'll start by importing the Naive Bayes classifier. Now let's import a tool that'll help us evaluate the accuracy of our model. Now we have imported Naive Bayes and we've imported a classification…

Contents