# Movie Genre Classifier

## Procedure

Please refer to the previous blog for data acquisition and processing as well as sever and DBMS configuration. For the classifier developing, SVM and Naive Bayes have been tested on the movie dataset. Due to the similar accuracy and better time complexity for Naive Bayes, we finally developed the classifier by Naive Bayes. Html/CSS, Php and Python are used for developing the classifier. Procedure are listed as following,

1. Since this classifier is developed depended on LAMP, runing python directly on Apache is not a good choice. We use an intermediate php script to call the python script running which is similiar to run python through bash.

2. The Naive Bayes Classifier was trained in python by movie dataset, and using 10% to test the accuracy of the classifier. The movie dataset include two numeric columns, budget and revenue, one character column, genre. We use the equation of Naive Bayes to calculate the probability of a movie with certain budget and revenue belonging to certain genres, and pick up the genre to be the movie genre which has the largest probability. For example, if we want to check if a movie is action with budget \$15,000,000 and revenue \$356,296,601, we can calculate the probability by the formula below. We also have to calculate other probabilities for other genres with the same budget and revenue. If probability of action is the highest, we conclude a movie with budget \$15,000,000 and revenue \$356,296,601 belong to genre action.

3. We save the trained classifier as a file for future quick access.

4. A simple webpage is developed by html/css. A php script developed for handling user input and call another python script to run the classifier retrieving final genre.

Scripts on Github: GitHub

## Naive Bayes Algorithm

Bayes theorem provides a way of calculating the posterior probability, P(c|x), from P©, P(x), and P(x|c). Naive Bayes classifier assume that the effect of the value of a predictor (x) on a given class © is independent of the values of other predictors. This assumption is called class conditional independence.