Professional Documents
Culture Documents
DM 6 Pratyush
DM 6 Pratyush
Experiment 2.2
2. Theory:
Naive Bayes classifier is a probabilistic machine learning algorithm that is commonly used for classification
problems. The algorithm is based on Bayes' theorem, which states that the probability of an event occurring
based on prior knowledge of conditions that might be related to the event.
In a Naive Bayes classifier, each feature is considered independently of other features, and the algorithm
makes a naive assumption that the features are all independent of each other. This simplifies the calculations
required to determine the probability of a particular classification for a given set of features.
= read.csv('Social_Network_Ads.csv') dataset =
dataset[3:5]
= scale(test_set[-3])
DEPARTMENT OF
training_set[-3],
y = training_set$Purchased)
print(classifier)
sum(diag(cm_train))/sum(cm_train) cat("\nAccuracy on
Output-
DEPARTMENT OF