CS 251: Project #7

Project 7: Naive Bayes Analysis

Project due Monday night Apr 14, 2014

The purpose of this assignment is to use your Naive Bayes implementation to classify data. You will evaluate the effectiveness of the classifier and plot the results.


  1. Write analysis.computeConfusionMatrix
            # compute the confusion matrix given the two columns of actual and
            # predicted class values.
            # Each of the inputs is an N x 1 matrix, and its values are 0, 1, ..., C-1
            # where C is the number of classes
            def computeConfusionMatrix( actual_class_vals, predicted_class_vals )
  2. Test the confusion matrix code by running naive_bayes_test3.py. The output Stephanie gets for her code is here.
  3. Write specialized scripts to test the naive bayes classifier on 2 more sets of data. Each data must have a class feature (e.g. the name of the iris species), so you may not be able to use one from a previous project. (Note that it was an extension in project 2 to turn enumerated types into numeric types. If you have not completed that extension, then you will need to make sure that the class values are integers between 0 and C-1 where C is the number of classes.)
  4. Write out your data and classification results to a file, then visualize it using your display.py program.



For this week's writeup, create a wiki page that shows your Naive Bayes results (images are helpful!), analyzes the results of your classifying from task 3, and explains any extensions.


Once you have written up your assignment, give the page the label:


Put your code in a folder named Proj7 on the Courses/CS251 server in your private subdirectory.