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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
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()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

How to find accuracy in R?

A

We take the mean of prediction compared to actual values:

mean(prediction == testset$)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Is Data Scaling necessary?

A

There is no need to scale the data in Naive Bayes.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly