How can we use Naive Bayes classifier for categorical features? What if some features are numerical?
How can we use Naive Bayes classifier for categorical features? What if some features are numerical?
1 Answer
We can use naïve bayes classifier for categorical variables using one-hot encoding. If we have n categories then we create n-1 dummy variables or features and add to our data. If the particular category is associated with a row then we assign it as 1 otherwise 0. If we have some numerical features we can discretize numeric values into few categories. For example we can categorize marks of students in a class as low, medium or high. Other method we can use for this is probability density function where we assume the probability distribution of attribute follows a normal distribution