Naive Bayes Flashcards
(5 cards)
1
Q
What is it for?
A
Classification only.
It’s used when all features have equal weight, and are independent.
2
Q
What do we have to do if predicted values are 0 and 1?
A
We have to tell the classifier that 0 and 1 are categorical data. we use as.factor()
3
Q
How to find accuracy in R?
A
We take the mean of prediction compared to actual values:
mean(prediction == testset$)
4
Q
Is Data Scaling necessary?
A
There is no need to scale the data in Naive Bayes.
5
Q
How do we predict new inputs in R?
A
- The input needs to be Class data.frame.
- then, we use the function predict, with the Classifier and the input data (minus the output).
nb = NaiveBayes(target ~ ., data=trainset)
predict(nb, new_input[:, -col_num]) # col_num is result